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

master_company_dimension.go 2.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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_company_dimension", "公司维度表 - 存储公司相关分类标准,如公司类型、行业分类、规模等").
  9. ChineseName("公司维度表").Aliases("公司维度").
  10. ID("id", 50).NotNull().Comment("主键ID").ChineseName("主键ID").End().
  11. String("type", 30).NotNull().Comment("维度类型: company_type(公司类型)/industry(行业)/scale(规模)/region(区域)").ChineseName("维度类型: company_type").End().
  12. String("code", 50).NotNull().Comment("编码").ChineseName("编码").Aliases("编码").End().
  13. String("name", 100).NotNull().Comment("名称").ChineseName("名称").Aliases("名称").End().
  14. String("description", 500).Comment("描述").ChineseName("描述").End().
  15. Int("sort_order").Comment("显示次序").ChineseName("显示次序").End().
  16. DateTime("created_at").NotNull().Default("CURRENT_TIMESTAMP").Comment("创建时间").ChineseName("创建时间").Aliases("时间").End().
  17. DateTime("updated_at").NotNull().Default("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").Comment("更新时间").ChineseName("更新时间").Aliases("时间").End()
  18. tb.AddIndex("idx_type", "type")
  19. tb.AddIndex("idx_code", "code")
  20. tb.AddIndex("idx_sort_order", "sort_order")
  21. tb.AddUniqueIndex("uk_type_code", "type", "code")
  22. r.RegisterTable(tb.Build())
  23. })
  24. }
  25. type MasterCompanyDimension struct {
  26. ID string `gorm:"column:id;type:varchar(50);not null;primaryKey;comment:主键ID"`
  27. Type string `gorm:"column:type;type:varchar(30);not null;comment:维度类型: company_type(公司类型)/industry(行业)/scale(规模)/region(区域)"`
  28. Code string `gorm:"column:code;type:varchar(50);not null;comment:编码"`
  29. Name string `gorm:"column:name;type:varchar(100);not null;comment:名称"`
  30. Description string `gorm:"column:description;type:varchar(500);comment:描述"`
  31. SortOrder int32 `gorm:"column:sort_order;type:int;comment:显示次序"`
  32. CreatedAt time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP;comment:创建时间"`
  33. UpdatedAt time.Time `gorm:"column:updated_at;not null;default:CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;comment:更新时间"`
  34. }
  35. type MasterCompanyDimensionDB struct {
  36. ID string `db:"id" json:"id"`
  37. Type string `db:"type" json:"type"`
  38. Code string `db:"code" json:"code"`
  39. Name string `db:"name" json:"name"`
  40. Description string `db:"description" json:"description"`
  41. SortOrder int32 `db:"sort_order" json:"sortOrder"`
  42. CreatedAt time.Time `db:"created_at" json:"createdAt"`
  43. UpdatedAt time.Time `db:"updated_at" json:"updatedAt"`
  44. }
  45. func (MasterCompanyDimension) TableName() string {
  46. return "master_company_dimension"
  47. }