Без опису
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

123456789101112131415161718192021222324252627282930313233343536
  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("dim_store", "店铺档案表").
  9. ID("store_id", 32).Comment("店铺ID,主键").End().
  10. String("store_code", 32).NotNull().Unique().Comment("店铺编码").End().
  11. String("store_name", 64).NotNull().Comment("店铺名称").End().
  12. String("store_group_id", 32).Comment("所属店铺组ID").End().
  13. String("region_code", 32).Comment("区域编码").End().
  14. String("creator", 32).NotNull().Comment("创建人").End().
  15. DateTime("created_at").NotNull().Default("CURRENT_TIMESTAMP").Comment("创建时间").End().
  16. DateTime("updated_at").NotNull().Default("CURRENT_TIMESTAMP").Comment("最后修改时间").End()
  17. r.RegisterTable(tb.Build())
  18. })
  19. }
  20. type DimStore struct {
  21. StoreID string `gorm:"column:store_id;type:varchar(32);primaryKey;not null;comment:店铺ID,主键"`
  22. StoreCode string `gorm:"column:store_code;type:varchar(32);not null;unique;comment:店铺编码"`
  23. StoreName string `gorm:"column:store_name;type:varchar(64);not null;comment:店铺名称"`
  24. StoreGroupID string `gorm:"column:store_group_id;type:varchar(32);comment:所属店铺组ID"`
  25. RegionCode string `gorm:"column:region_code;type:varchar(32);comment:区域编码"`
  26. Creator string `gorm:"column:creator;type:varchar(32);not null;comment:创建人"`
  27. CreatedAt time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP;comment:创建时间"`
  28. UpdatedAt time.Time `gorm:"column:updated_at;not null;default:CURRENT_TIMESTAMP;comment:最后修改时间"`
  29. TenantId string `gorm:"column:tenant_id;type:varchar(8);comment:租户ID"`
  30. }
  31. func (DimStore) TableName() string { return "dim_store" }