Açıklama Yok
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_company.go 6.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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", "公司主数据表 - 存储法人实体信息,用于结算和管理").
  9. ID("id", 50).NotNull().Comment("公司ID").End().
  10. String("type", 30).NotNull().Default("'SUBSIDIARY'").Comment("公司类型: SUPPLIER供应商/SUBSIDIARY子公司/AGENT代理商/WHOLESALER批发商/GROUP集团/FRANCHISEE加盟商/CUSTOMER客户/LOGISTICS物流商").End().
  11. String("code", 50).NotNull().Comment("公司编码").End().
  12. String("name", 200).NotNull().Comment("公司名称").End().
  13. String("short_name", 100).Comment("公司简称").End().
  14. String("english_name", 200).Comment("英文名称").End().
  15. String("parent_id", 50).Comment("上级公司ID").End().
  16. Int("level").Comment("公司层级 1:集团 2:子公司 3:分公司").End().
  17. String("tax_id", 30).Comment("税号/统一社会信用代码").End().
  18. String("legal_representative", 50).Comment("法定代表人").End().
  19. String("contact_person", 50).Comment("联系人").End().
  20. String("contact_phone", 20).Comment("联系电话").End().
  21. String("email", 100).Comment("邮箱").End().
  22. String("address", 500).Comment("公司地址").End().
  23. String("bank_name", 100).Comment("开户银行").End().
  24. String("bank_account", 50).Comment("银行账号").End().
  25. String("account_holder", 100).Comment("账户持有人").End().
  26. String("status", 20).Comment("状态 ACTIVE/INACTIVE").End().
  27. Bool("is_active").Comment("是否激活").End().
  28. Text("remark").Comment("备注").End().
  29. JSON("extra_properties").Comment("扩展属性JSON").End().
  30. DateTime("created_at").NotNull().Default("CURRENT_TIMESTAMP").Comment("创建时间").End().
  31. DateTime("updated_at").NotNull().Default("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").Comment("更新时间").End()
  32. tb.AddUniqueIndex("idx_code", "code")
  33. tb.AddIndex("idx_type", "type")
  34. tb.AddIndex("idx_parent_id", "parent_id")
  35. tb.AddIndex("idx_status", "status")
  36. tb.AddIndex("idx_level", "level")
  37. tb.AddIndex("idx_tax_id", "tax_id")
  38. r.RegisterTable(tb.Build())
  39. })
  40. }
  41. type MasterCompany struct {
  42. ID string `gorm:"column:id;type:varchar(50);not null;primaryKey;comment:公司ID"`
  43. Type string `gorm:"column:type;type:varchar(30);not null;default:SUBSIDIARY;comment:公司类型: SUPPLIER供应商/SUBSIDIARY子公司/AGENT代理商/WHOLESALER批发商/GROUP集团/FRANCHISEE加盟商/CUSTOMER客户/LOGISTICS物流商"`
  44. Code string `gorm:"column:code;type:varchar(50);not null;comment:公司编码"`
  45. Name string `gorm:"column:name;type:varchar(200);not null;comment:公司名称"`
  46. ShortName string `gorm:"column:short_name;type:varchar(100);comment:公司简称"`
  47. EnglishName string `gorm:"column:english_name;type:varchar(200);comment:英文名称"`
  48. ParentID string `gorm:"column:parent_id;type:varchar(50);comment:上级公司ID"`
  49. Level int32 `gorm:"column:level;type:int;comment:公司层级 1:集团 2:子公司 3:分公司"`
  50. TaxID string `gorm:"column:tax_id;type:varchar(30);comment:税号/统一社会信用代码"`
  51. LegalRepresentative string `gorm:"column:legal_representative;type:varchar(50);comment:法定代表人"`
  52. ContactPerson string `gorm:"column:contact_person;type:varchar(50);comment:联系人"`
  53. ContactPhone string `gorm:"column:contact_phone;type:varchar(20);comment:联系电话"`
  54. Email string `gorm:"column:email;type:varchar(100);comment:邮箱"`
  55. Address string `gorm:"column:address;type:varchar(500);comment:公司地址"`
  56. BankName string `gorm:"column:bank_name;type:varchar(100);comment:开户银行"`
  57. BankAccount string `gorm:"column:bank_account;type:varchar(50);comment:银行账号"`
  58. AccountHolder string `gorm:"column:account_holder;type:varchar(100);comment:账户持有人"`
  59. Status string `gorm:"column:status;type:varchar(20);comment:状态 ACTIVE/INACTIVE"`
  60. IsActive bool `gorm:"column:is_active;type:bool;comment:是否激活"`
  61. Remark string `gorm:"column:remark;type:text;comment:备注"`
  62. ExtraProperties string `gorm:"column:extra_properties;type:json;comment:扩展属性JSON"`
  63. CreatedAt time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP;comment:创建时间"`
  64. UpdatedAt time.Time `gorm:"column:updated_at;not null;default:CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;comment:更新时间"`
  65. }
  66. type MasterCompanyDB struct {
  67. ID string `db:"id" json:"id"`
  68. Type string `db:"type" json:"type"`
  69. Code string `db:"code" json:"code"`
  70. Name string `db:"name" json:"name"`
  71. ShortName string `db:"short_name" json:"shortName"`
  72. EnglishName string `db:"english_name" json:"englishName"`
  73. ParentID string `db:"parent_id" json:"parentID"`
  74. Level int32 `db:"level" json:"level"`
  75. TaxID string `db:"tax_id" json:"taxID"`
  76. LegalRepresentative string `db:"legal_representative" json:"legalRepresentative"`
  77. ContactPerson string `db:"contact_person" json:"contactPerson"`
  78. ContactPhone string `db:"contact_phone" json:"contactPhone"`
  79. Email string `db:"email" json:"email"`
  80. Address string `db:"address" json:"address"`
  81. BankName string `db:"bank_name" json:"bankName"`
  82. BankAccount string `db:"bank_account" json:"bankAccount"`
  83. AccountHolder string `db:"account_holder" json:"accountHolder"`
  84. Status string `db:"status" json:"status"`
  85. IsActive bool `db:"is_active" json:"isActive"`
  86. Remark string `db:"remark" json:"remark"`
  87. ExtraProperties string `db:"extra_properties" json:"extraProperties"`
  88. CreatedAt time.Time `db:"created_at" json:"createdAt"`
  89. UpdatedAt time.Time `db:"updated_at" json:"updatedAt"`
  90. }
  91. func (MasterCompany) TableName() string {
  92. return "master_company"
  93. }