| 1234567891011121314151617181920212223242526272829303132 |
- package tables
-
- import (
- "time"
-
- "git.x2erp.com/qdy/go-db/sqldef"
- )
-
- func init() {
- sqldef.AddRegistration(func(r *sqldef.Registry) {
- tb := sqldef.NewTable("dim_category", "品类档案表").
- ID("category_id", 32).Comment("品类ID,主键").End().
- String("category_code", 32).NotNull().Unique().Comment("品类编码").End().
- String("category_name", 64).NotNull().Comment("品类名称").End().
- String("season_attribute", 32).Comment("季节属性(春/夏/秋/冬/四季)").End().
- String("creator", 32).NotNull().Comment("创建人").End().
- DateTime("created_at").NotNull().Default("CURRENT_TIMESTAMP").Comment("创建时间").End()
- r.RegisterTable(tb.Build())
- })
- }
-
- type DimCategory struct {
- CategoryID string `gorm:"column:category_id;type:varchar(32);primaryKey;not null;comment:品类ID,主键"`
- CategoryCode string `gorm:"column:category_code;type:varchar(32);not null;unique;comment:品类编码"`
- CategoryName string `gorm:"column:category_name;type:varchar(64);not null;comment:品类名称"`
- SeasonAttribute string `gorm:"column:season_attribute;type:varchar(32);comment:季节属性"`
- Creator string `gorm:"column:creator;type:varchar(32);not null;comment:创建人"`
- CreatedAt time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP;comment:创建时间"`
- TenantId string `gorm:"column:tenant_id;type:varchar(8);comment:租户ID"`
- }
-
- func (DimCategory) TableName() string { return "dim_category" }
|