You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
1.8 KiB

  1. // 自动生成模板SysDictionary
  2. package model
  3. import (
  4. "gorm.io/gorm"
  5. "time"
  6. )
  7. // 如果含有time.Time 请自行import time包
  8. type SysDictionary struct {
  9. gorm.Model
  10. Name string `json:"name" form:"name" gorm:"column:name;comment:'字典名(中)'"`
  11. Type string `json:"type" form:"type" gorm:"column:type;comment:'字典名(英)'"`
  12. Status *bool `json:"status" form:"status" gorm:"column:status;comment:'状态'"`
  13. Desc string `json:"desc" form:"desc" gorm:"column:desc;comment:'描述'"`
  14. SysDictionaryDetails []SysDictionaryDetail `json:"sysDictionaryDetails" form:"sysDictionaryDetails"`
  15. }
  16. func SysDictionaryData() []SysDictionary {
  17. status := new(bool)
  18. *status = true
  19. return []SysDictionary{
  20. {Model: gorm.Model{ID: 1, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "性别", Type: "sex", Status: status, Desc: "性别字典"},
  21. {Model: gorm.Model{ID: 2, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "数据库int类型", Type: "int", Status: status, Desc: "int类型对应的数据库类型"},
  22. {Model: gorm.Model{ID: 3, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "数据库时间日期类型", Type: "time.Time", Status: status, Desc: "数据库时间日期类型"},
  23. {Model: gorm.Model{ID: 4, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "数据库浮点型", Type: "float64", Status: status, Desc: "数据库浮点型"},
  24. {Model: gorm.Model{ID: 5, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "数据库字符串", Type: "string", Status: status, Desc: "数据库字符串"},
  25. {Model: gorm.Model{ID: 6, CreatedAt: time.Now(), UpdatedAt: time.Now()}, Name: "数据库bool类型", Type: "bool", Status: status, Desc: "数据库bool类型"},
  26. }
  27. }