| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- package tables
-
- import (
- "time"
-
- "git.x2erp.com/qdy/go-db/sqldef"
- )
-
- func init() {
- sqldef.AddRegistration(func(r *sqldef.Registry) {
- tb := sqldef.NewTable("product_sku", "商品档案表").
- ID("sku_id", 32).Comment("款色码唯一标识,主键").End().
- String("sku_code", 64).NotNull().Comment("商品款号").End().
- String("sku_name", 128).NotNull().Comment("商品名称").End().
- String("category_code", 32).NotNull().Comment("品类编码").End().
- String("category_name", 64).NotNull().Comment("品类名称").End().
- String("season_code", 32).NotNull().Comment("季节波段编码").End().
- String("season_name", 64).NotNull().Comment("季节波段名称").End().
- String("tenant_id", 8).NotNull().Comment("租户ID").End().
- DateTime("first_list_date").NotNull().Comment("首次上市日期").End().
- Decimal("tag_price", 10, 2).NotNull().Comment("吊牌价").End().
- String("creator", 32).NotNull().Comment("创建人").End().
- DateTime("created_at").NotNull().Default("CURRENT_TIMESTAMP").Comment("创建时间").End().
- DateTime("updated_at").NotNull().Default("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").Comment("更新时间").End()
- r.RegisterTable(tb.Build())
- })
- }
-
- // ProductSku 商品档案表结构体
- type ProductSku struct {
- SkuID string `gorm:"column:sku_id;type:varchar(32);primaryKey;not null;comment:款色码唯一标识,主键"`
- SkuCode string `gorm:"column:sku_code;type:varchar(64);not null;comment:商品款号"`
- SkuName string `gorm:"column:sku_name;type:varchar(128);not null;comment:商品名称"`
- CategoryCode string `gorm:"column:category_code;type:varchar(32);not null;comment:品类编码"`
- CategoryName string `gorm:"column:category_name;type:varchar(64);not null;comment:品类名称"`
- SeasonCode string `gorm:"column:season_code;type:varchar(32);not null;comment:季节波段编码"`
- SeasonName string `gorm:"column:season_name;type:varchar(64);not null;comment:季节波段名称"`
- FirstListDate time.Time `gorm:"column:first_list_date;not null;comment:首次上市日期"`
- TagPrice float64 `gorm:"column:tag_price;type:decimal(10,2);not null;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 ON UPDATE CURRENT_TIMESTAMP;comment:更新时间"`
- TenantId string `gorm:"column:tenant_id;type:varchar(8);comment:租户ID"`
- }
-
- func (ProductSku) TableName() string {
- return "product_sku"
- }
|