暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

dim_category.go 1.5KB

1234567891011121314151617181920212223242526272829303132
  1. package tables
  2. import (
  3. "time"
  4. "git.x2erp.com/qdy/go-db/sqldef"
  5. )
  6. func init() {
  7. sqldef.AddRegistration(func(r *sqldef.Registry) {
  8. tb := sqldef.NewTable("dim_category", "品类档案表").
  9. ID("category_id", 32).Comment("品类ID,主键").End().
  10. String("category_code", 32).NotNull().Unique().Comment("品类编码").End().
  11. String("category_name", 64).NotNull().Comment("品类名称").End().
  12. String("season_attribute", 32).Comment("季节属性(春/夏/秋/冬/四季)").End().
  13. String("creator", 32).NotNull().Comment("创建人").End().
  14. DateTime("created_at").NotNull().Default("CURRENT_TIMESTAMP").Comment("创建时间").End()
  15. r.RegisterTable(tb.Build())
  16. })
  17. }
  18. type DimCategory struct {
  19. CategoryID string `gorm:"column:category_id;type:varchar(32);primaryKey;not null;comment:品类ID,主键"`
  20. CategoryCode string `gorm:"column:category_code;type:varchar(32);not null;unique;comment:品类编码"`
  21. CategoryName string `gorm:"column:category_name;type:varchar(64);not null;comment:品类名称"`
  22. SeasonAttribute string `gorm:"column:season_attribute;type:varchar(32);comment:季节属性"`
  23. Creator string `gorm:"column:creator;type:varchar(32);not null;comment:创建人"`
  24. CreatedAt time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP;comment:创建时间"`
  25. TenantId string `gorm:"column:tenant_id;type:varchar(8);comment:租户ID"`
  26. }
  27. func (DimCategory) TableName() string { return "dim_category" }