package tables import ( "time" "git.x2erp.com/qdy/go-db/sqldef" ) func init() { sqldef.AddRegistration(func(r *sqldef.Registry) { tb := sqldef.NewTable("dim_store", "店铺档案表"). ID("store_id", 32).Comment("店铺ID,主键").End(). String("store_code", 32).NotNull().Unique().Comment("店铺编码").End(). String("store_name", 64).NotNull().Comment("店铺名称").End(). String("store_group_id", 32).Comment("所属店铺组ID").End(). String("region_code", 32).Comment("区域编码").End(). String("creator", 32).NotNull().Comment("创建人").End(). DateTime("created_at").NotNull().Default("CURRENT_TIMESTAMP").Comment("创建时间").End(). DateTime("updated_at").NotNull().Default("CURRENT_TIMESTAMP").Comment("最后修改时间").End() r.RegisterTable(tb.Build()) }) } type DimStore struct { StoreID string `gorm:"column:store_id;type:varchar(32);primaryKey;not null;comment:店铺ID,主键"` StoreCode string `gorm:"column:store_code;type:varchar(32);not null;unique;comment:店铺编码"` StoreName string `gorm:"column:store_name;type:varchar(64);not null;comment:店铺名称"` StoreGroupID string `gorm:"column:store_group_id;type:varchar(32);comment:所属店铺组ID"` RegionCode string `gorm:"column:region_code;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:创建时间"` UpdatedAt time.Time `gorm:"column:updated_at;not null;default:CURRENT_TIMESTAMP;comment:最后修改时间"` TenantId string `gorm:"column:tenant_id;type:varchar(8);comment:租户ID"` } func (DimStore) TableName() string { return "dim_store" }