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

product_sku.go 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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("product_sku", "商品档案表").
  9. ID("sku_id", 32).Comment("款色码唯一标识,主键").End().
  10. String("sku_code", 64).NotNull().Comment("商品款号").End().
  11. String("sku_name", 128).NotNull().Comment("商品名称").End().
  12. String("category_code", 32).NotNull().Comment("品类编码").End().
  13. String("category_name", 64).NotNull().Comment("品类名称").End().
  14. String("season_code", 32).NotNull().Comment("季节波段编码").End().
  15. String("season_name", 64).NotNull().Comment("季节波段名称").End().
  16. String("tenant_id", 8).NotNull().Comment("租户ID").End().
  17. DateTime("first_list_date").NotNull().Comment("首次上市日期").End().
  18. Decimal("tag_price", 10, 2).NotNull().Comment("吊牌价").End().
  19. String("creator", 32).NotNull().Comment("创建人").End().
  20. DateTime("created_at").NotNull().Default("CURRENT_TIMESTAMP").Comment("创建时间").End().
  21. DateTime("updated_at").NotNull().Default("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").Comment("更新时间").End()
  22. r.RegisterTable(tb.Build())
  23. })
  24. }
  25. // ProductSku 商品档案表结构体
  26. type ProductSku struct {
  27. SkuID string `gorm:"column:sku_id;type:varchar(32);primaryKey;not null;comment:款色码唯一标识,主键"`
  28. SkuCode string `gorm:"column:sku_code;type:varchar(64);not null;comment:商品款号"`
  29. SkuName string `gorm:"column:sku_name;type:varchar(128);not null;comment:商品名称"`
  30. CategoryCode string `gorm:"column:category_code;type:varchar(32);not null;comment:品类编码"`
  31. CategoryName string `gorm:"column:category_name;type:varchar(64);not null;comment:品类名称"`
  32. SeasonCode string `gorm:"column:season_code;type:varchar(32);not null;comment:季节波段编码"`
  33. SeasonName string `gorm:"column:season_name;type:varchar(64);not null;comment:季节波段名称"`
  34. FirstListDate time.Time `gorm:"column:first_list_date;not null;comment:首次上市日期"`
  35. TagPrice float64 `gorm:"column:tag_price;type:decimal(10,2);not null;comment:吊牌价"`
  36. Creator string `gorm:"column:creator;type:varchar(32);not null;comment:创建人"`
  37. CreatedAt time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP;comment:创建时间"`
  38. UpdatedAt time.Time `gorm:"column:updated_at;not null;default:CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;comment:更新时间"`
  39. TenantId string `gorm:"column:tenant_id;type:varchar(8);comment:租户ID"`
  40. }
  41. func (ProductSku) TableName() string {
  42. return "product_sku"
  43. }