Ingen beskrivning
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

master_product_dimension.go 2.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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("master_product_dimension", "商品维度表 - 存储商品相关分类标准,如大类、小类、季节、波段、面料等").
  9. ID("id", 50).NotNull().Comment("主键ID").End().
  10. String("type", 30).NotNull().Comment("维度类型: category_major(大类)/category_minor(小类)/season(季节)/wave(波段)/fabric(面料)/color_family(色系)/size_group(尺码组)").End().
  11. String("code", 50).NotNull().Comment("编码").End().
  12. String("name", 100).NotNull().Comment("名称").End().
  13. String("description", 500).Comment("描述").End().
  14. Int("sort_order").Comment("显示次序").End().
  15. DateTime("created_at").NotNull().Default("CURRENT_TIMESTAMP").Comment("创建时间").End().
  16. DateTime("updated_at").NotNull().Default("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").Comment("更新时间").End()
  17. tb.AddIndex("idx_type", "type")
  18. tb.AddIndex("idx_code", "code")
  19. tb.AddIndex("idx_sort_order", "sort_order")
  20. tb.AddUniqueIndex("uk_type_code", "type", "code")
  21. r.RegisterTable(tb.Build())
  22. })
  23. }
  24. type MasterProductDimension struct {
  25. ID string `gorm:"column:id;type:varchar(50);not null;primaryKey;comment:主键ID"`
  26. Type string `gorm:"column:type;type:varchar(30);not null;comment:维度类型: category_major(大类)/category_minor(小类)/season(季节)/wave(波段)/fabric(面料)/color_family(色系)/size_group(尺码组)"`
  27. Code string `gorm:"column:code;type:varchar(50);not null;comment:编码"`
  28. Name string `gorm:"column:name;type:varchar(100);not null;comment:名称"`
  29. Description string `gorm:"column:description;type:varchar(500);comment:描述"`
  30. SortOrder int32 `gorm:"column:sort_order;type:int;comment:显示次序"`
  31. CreatedAt time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP;comment:创建时间"`
  32. UpdatedAt time.Time `gorm:"column:updated_at;not null;default:CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;comment:更新时间"`
  33. }
  34. type MasterProductDimensionDB struct {
  35. ID string `db:"id" json:"id"`
  36. Type string `db:"type" json:"type"`
  37. Code string `db:"code" json:"code"`
  38. Name string `db:"name" json:"name"`
  39. Description string `db:"description" json:"description"`
  40. SortOrder int32 `db:"sort_order" json:"sortOrder"`
  41. CreatedAt time.Time `db:"created_at" json:"createdAt"`
  42. UpdatedAt time.Time `db:"updated_at" json:"updatedAt"`
  43. }
  44. func (MasterProductDimension) TableName() string {
  45. return "master_product_dimension"
  46. }