company.go 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. package company
  2. import "time"
  3. // Company 客户表
  4. type Company struct {
  5. CompanyID uint64 `gorm:"primaryKey;column:company_id;type:bigint(20) unsigned;not null" json:"-"` // 客户id
  6. CompanyName string `gorm:"index:company_name;column:company_name;type:varchar(100)" json:"companyName"` // 客户名称
  7. CreditCode string `gorm:"column:credit_code;type:varchar(30)" json:"creditCode"` // 社会统一信用码
  8. CompanyCode string `gorm:"index:company_code;column:company_code;type:varchar(32)" json:"companyCode"` // 客户编码
  9. Sort int `gorm:"column:sort;type:int(10);default:1" json:"sort"` // 优先级
  10. IsFeeCustomer int8 `gorm:"column:is_fee_customer;type:tinyint(1)" json:"isFeeCustomer"` // 是否付费用户
  11. Country string `gorm:"column:country;type:varchar(20)" json:"country"` // 国家编码
  12. ProvinceID int64 `gorm:"index:province_id;column:province_id;type:bigint(20)" json:"provinceId"` // 省id
  13. CityID int64 `gorm:"index:city_id;column:city_id;type:bigint(20)" json:"cityId"` // 市id
  14. Address string `gorm:"column:address;type:varchar(512)" json:"address"` // 详细地址
  15. Type int `gorm:"column:type;type:int(10);default:1" json:"type"` // 客户标签,1:付费客户,2:试用客户,3:流失客户,4:潜在客户,5:永续
  16. Enabled int8 `gorm:"index:enabled;column:enabled;type:tinyint(1);default:1" json:"enabled"` // 用户状态
  17. CreatedTime time.Time `gorm:"index:created_time;column:created_time;type:datetime;default:CURRENT_TIMESTAMP" json:"createdTime"` // 创建时间
  18. LastUpdatedTime time.Time `gorm:"index:last_updated_time;column:last_updated_time;type:timestamp;not null;default:CURRENT_TIMESTAMP" json:"lastUpdatedTime"`
  19. Seller string `gorm:"column:seller;type:varchar(200)" json:"seller"` // 销售员
  20. SellsID int64 `gorm:"index:idx_sells_id;column:sells_id;type:bigint(20)" json:"sellsId"` // 销售员id
  21. CompanyBelong string `gorm:"column:company_belong;type:varchar(30);default:ficc" json:"companyBelong"` // 客户所属,ficc:ficc客户,public_offering:公募客户,partner:合作伙伴
  22. StartDate time.Time `gorm:"column:start_date;type:date" json:"startDate"` // 合同开始日期
  23. EndDate time.Time `gorm:"column:end_date;type:date" json:"endDate"` // 合同结束日期
  24. LoseReason string `gorm:"column:lose_reason;type:varchar(1024);default:''" json:"loseReason"` // 流失原因
  25. LastType int `gorm:"column:last_type;type:int(10)" json:"lastType"` // 原客户标签
  26. LossTime time.Time `gorm:"column:loss_time;type:datetime;not null" json:"lossTime"` // 流失时间
  27. FirstStartDate time.Time `gorm:"column:first_start_date;type:date" json:"firstStartDate"` // 首次设置为试用客户开始时间
  28. FirstEndDate time.Time `gorm:"column:first_end_date;type:date" json:"firstEndDate"` // 首次设置为试用客户结束时间
  29. DateType int `gorm:"column:date_type;type:int(11);default:0" json:"dateType"`
  30. Remark string `gorm:"column:remark;type:varchar(255)" json:"remark"` // 备注
  31. Province string `gorm:"column:province;type:varchar(100);default:''" json:"province"` // 省
  32. City string `gorm:"column:city;type:varchar(100);default:''" json:"city"` // 市
  33. IsVip int8 `gorm:"column:is_vip;type:tinyint(4)" json:"isVip"` // 0:普通用户,1:大客户
  34. RegionType string `gorm:"column:region_type;type:varchar(30);default:''" json:"regionType"` // 国内,海外
  35. OpenCompanyCode string `gorm:"column:open_company_code;type:varchar(64);default:''" json:"openCompanyCode"` // 开放给第三方的客户编码,不让第三方定位我们的客户信息
  36. }
  37. // TableName get sql table name.获取数据库表名
  38. func (m *Company) TableName() string {
  39. return "company"
  40. }
  41. // CompanyColumns get sql column name.获取数据库列名
  42. var CompanyColumns = struct {
  43. CompanyID string
  44. CompanyName string
  45. CreditCode string
  46. CompanyCode string
  47. Sort string
  48. IsFeeCustomer string
  49. Country string
  50. ProvinceID string
  51. CityID string
  52. Address string
  53. Type string
  54. Enabled string
  55. CreatedTime string
  56. LastUpdatedTime string
  57. Seller string
  58. SellsID string
  59. CompanyBelong string
  60. StartDate string
  61. EndDate string
  62. LoseReason string
  63. LastType string
  64. LossTime string
  65. FirstStartDate string
  66. FirstEndDate string
  67. DateType string
  68. Remark string
  69. Province string
  70. City string
  71. IsVip string
  72. RegionType string
  73. OpenCompanyCode string
  74. }{
  75. CompanyID: "company_id",
  76. CompanyName: "company_name",
  77. CreditCode: "credit_code",
  78. CompanyCode: "company_code",
  79. Sort: "sort",
  80. IsFeeCustomer: "is_fee_customer",
  81. Country: "country",
  82. ProvinceID: "province_id",
  83. CityID: "city_id",
  84. Address: "address",
  85. Type: "type",
  86. Enabled: "enabled",
  87. CreatedTime: "created_time",
  88. LastUpdatedTime: "last_updated_time",
  89. Seller: "seller",
  90. SellsID: "sells_id",
  91. CompanyBelong: "company_belong",
  92. StartDate: "start_date",
  93. EndDate: "end_date",
  94. LoseReason: "lose_reason",
  95. LastType: "last_type",
  96. LossTime: "loss_time",
  97. FirstStartDate: "first_start_date",
  98. FirstEndDate: "first_end_date",
  99. DateType: "date_type",
  100. Remark: "remark",
  101. Province: "province",
  102. City: "city",
  103. IsVip: "is_vip",
  104. RegionType: "region_type",
  105. OpenCompanyCode: "open_company_code",
  106. }