Brak opisu
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.

dim_store.go 1.6KB

12345678910111213141516171819202122232425262728293031323334
  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. r.RegisterTable(tb.Build())
  17. })
  18. }
  19. type DimStore struct {
  20. StoreID string `gorm:"column:store_id;type:varchar(32);primaryKey;not null;comment:店铺ID,主键"`
  21. StoreCode string `gorm:"column:store_code;type:varchar(32);not null;unique;comment:店铺编码"`
  22. StoreName string `gorm:"column:store_name;type:varchar(64);not null;comment:店铺名称"`
  23. StoreGroupID string `gorm:"column:store_group_id;type:varchar(32);comment:所属店铺组ID"`
  24. RegionCode string `gorm:"column:region_code;type:varchar(32);comment:区域编码"`
  25. Creator string `gorm:"column:creator;type:varchar(32);not null;comment:创建人"`
  26. CreatedAt time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP;comment:创建时间"`
  27. TenantId string `gorm:"column:tenant_id;type:varchar(8);comment:租户ID"`
  28. }
  29. func (DimStore) TableName() string { return "dim_store" }