数据初始化完成

This commit is contained in:
SliverHorn
2020-08-25 16:34:45 +08:00
parent 6c9f8b5eba
commit cf73dbd0d9
18 changed files with 566 additions and 8 deletions

View File

@@ -3,6 +3,7 @@ package model
import (
"gorm.io/gorm"
"time"
)
// 如果含有time.Time 请自行import time包
@@ -14,3 +15,16 @@ type SysDictionary struct {
Desc string `json:"desc" form:"desc" gorm:"column:desc;comment:'描述'"`
SysDictionaryDetails []SysDictionaryDetail `json:"sysDictionaryDetails" form:"sysDictionaryDetails"`
}
func SysDictionaryData() []SysDictionary {
status := new(bool)
*status = true
return []SysDictionary{
{Model: gorm.Model{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "性别", Type: "sex", Status: status, Desc: "性别字典"},
{Model: gorm.Model{ID: 2, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "数据库int类型", Type: "int", Status: status, Desc: "int类型对应的数据库类型"},
{Model: gorm.Model{ID: 3, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "数据库时间日期类型", Type: "time.Time", Status: status, Desc: "数据库时间日期类型"},
{Model: gorm.Model{ID: 4, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "数据库浮点型", Type: "float64", Status: status, Desc: "数据库浮点型"},
{Model: gorm.Model{ID: 5, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "数据库字符串", Type: "string", Status: status, Desc: "数据库字符串"},
{Model: gorm.Model{ID: 6, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "数据库bool类型", Type: "bool", Status: status, Desc: "数据库bool类型"},
}
}