company.go 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package company
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type Company struct {
  7. CompanyId int `orm:"column(company_id);pk"`
  8. CompanyName string `description:"客户名称"`
  9. CompanyType int `orm:"column(type)"`
  10. CreditCode string `description:"社会统一信用码"`
  11. CompanyCode string `description:"客户编码"`
  12. Sort int `description:"优先级"`
  13. IsFeeCustomer int `description:"是否付费用户"`
  14. Country string `description:"国家编码"`
  15. Province string `description:"省"`
  16. City string `description:"市"`
  17. Address string `description:"详细地址"`
  18. Enabled int `description:"用户状态"`
  19. CreatedTime time.Time `description:"创建时间"`
  20. LastUpdatedTime time.Time `description:"最后一次阅读时间"`
  21. Seller string `description:"销售员"`
  22. SellsId int `description:"销售员id"`
  23. ShareSeller string `description:"共享销售员"`
  24. ShareSellerId int `description:"共享销售员id"`
  25. CompanyBelong string `description:"客户所属,ficc:ficc客户,public_offering:公募客户,partner:合作伙伴"`
  26. StartDate string `description:"合同开始日期"`
  27. EndDate string `description:"合同结束日期"`
  28. LastType int `description:"原客户标签"`
  29. IsVip int `description:"0:普通用户,1:大客户"`
  30. IsShare int `description:"0:非共享用户,1:共享客户"`
  31. FirstStartDate string `description:"首次设置为试用客户开始时间"`
  32. FirstEndDate string `description:"首次设置为试用客户结束时间"`
  33. DateType int `description:"设置流失类型,1:1个月,2:2个月,3:3个月"`
  34. Remark string `description:"备注信息"`
  35. RegionType string `description:"地区类型,国内,国外"`
  36. OpenCompanyCode string `description:"开放给第三方的客户编码,不让第三方定位我们的客户信息"`
  37. }
  38. // 更新客户基础信息
  39. func (company *Company) Update(cols []string) (err error) {
  40. o := orm.NewOrm()
  41. _, err = o.Update(company, cols...)
  42. return
  43. }
  44. func ModifyCompanyGroupId(sellerId, groupId int) (err error) {
  45. o := orm.NewOrm()
  46. sql := `UPDATE company_product SET group_id=? WHERE seller_id=? `
  47. _, err = o.Raw(sql, groupId, sellerId).Exec()
  48. return
  49. }
  50. func ModifyCompanyDepartmentId(sellerId, departmentId int) (err error) {
  51. o := orm.NewOrm()
  52. sql := `UPDATE company_product SET department_id=? WHERE seller_id=? `
  53. _, err = o.Raw(sql, departmentId, sellerId).Exec()
  54. return
  55. }