模块化变更
This commit is contained in:
@@ -2,7 +2,7 @@ package source
|
||||
|
||||
import (
|
||||
"gin-vue-admin/global"
|
||||
"gin-vue-admin/model"
|
||||
"gin-vue-admin/model/system"
|
||||
"github.com/gookit/color"
|
||||
"time"
|
||||
|
||||
@@ -19,7 +19,7 @@ var status = new(bool)
|
||||
//@description: sys_dictionaries 表数据初始化
|
||||
func (d *dictionary) Init() error {
|
||||
*status = true
|
||||
var dictionaries = []model.SysDictionary{
|
||||
var dictionaries = []system.SysDictionary{
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "性别", Type: "sex", Status: status, Desc: "性别字典"},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 2, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "数据库int类型", Type: "int", Status: status, Desc: "int类型对应的数据库类型"},
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 3, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "数据库时间日期类型", Type: "time.Time", Status: status, Desc: "数据库时间日期类型"},
|
||||
@@ -28,7 +28,7 @@ func (d *dictionary) Init() error {
|
||||
{GVA_MODEL: global.GVA_MODEL{ID: 6, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "数据库bool类型", Type: "bool", Status: status, Desc: "数据库bool类型"},
|
||||
}
|
||||
return global.GVA_DB.Transaction(func(tx *gorm.DB) error {
|
||||
if tx.Where("id IN ?", []int{1, 6}).Find(&[]model.SysDictionary{}).RowsAffected == 2 {
|
||||
if tx.Where("id IN ?", []int{1, 6}).Find(&[]system.SysDictionary{}).RowsAffected == 2 {
|
||||
color.Danger.Println("\n[Mysql] --> sys_dictionaries 表初始数据已存在!")
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user