company_product.go 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type CompanyProduct struct {
  7. CompanyProductId int `orm:"column(company_product_id);pk" description:"客户产品id"`
  8. CompanyId int `description:"客户id"`
  9. ProductId int `description:"产品id"`
  10. ProductName string `description:"产品名称"`
  11. CompanyName string `description:"客户名称"`
  12. Source string `description:"来源"`
  13. Reasons string `description:"新增理由"`
  14. Status string `description:"客户状态"`
  15. IndustryId int `description:"行业id"`
  16. IndustryName string `description:"行业名称"`
  17. SellerId int `description:"销售id"`
  18. SellerName string `description:"销售名称"`
  19. GroupId int `description:"销售分组id"`
  20. DepartmentId int `description:"销售部门id"`
  21. IsSuspend int `description:"1:暂停,0:启用"`
  22. SuspendTime time.Time `description:"暂停启用时间"`
  23. TryOutTime time.Time `description:"正式转试用时间"`
  24. RenewalReason string `description:"正式转试用后的续约情况说明"`
  25. LastDescriptionTime time.Time `description:"上次添加说明时间"`
  26. RenewalIntention int `description:"是否勾选无续约意向,1:确认,0:未确认"`
  27. ApproveStatus string `description:"审批状态:'审批中','通过','驳回'"`
  28. FreezeTime time.Time `description:"冻结时间"`
  29. FreezeReason time.Time `description:"冻结理由"`
  30. Remark string `description:"备注信息"`
  31. CreateTime time.Time `description:"创建时间"`
  32. ModifyTime time.Time `description:"修改时间"`
  33. StartDate string `description:"开始日期"`
  34. EndDate string `description:"结束日期"`
  35. ContractEndDate time.Time `description:"合同结束日期"`
  36. LoseReason string `description:"流失原因"`
  37. LossTime time.Time `description:"流失时间"`
  38. CompanyType string `description:"客户类型"`
  39. OpenCode string `description:"开放给第三方的编码,不让第三方定位我们的客户信息"`
  40. }
  41. // 获取列表
  42. func GetCompanyProductList(condition string, pars []interface{}) (items []*CompanyProduct, err error) {
  43. o := orm.NewOrmUsingDB("weekly_report")
  44. sql := `SELECT * FROM company_product WHERE 1= 1 `
  45. if condition != "" {
  46. sql += condition
  47. }
  48. _, err = o.Raw(sql, pars).QueryRows(&items)
  49. return
  50. }
  51. func GetCompanyProductDetailByCompanyId(companyId, productId int) (item *CompanyProduct, err error) {
  52. sql := ` SELECT * FROM company_product WHERE company_id = ? AND product_id = ?; `
  53. o := orm.NewOrmUsingDB("weekly_report")
  54. err = o.Raw(sql, companyId, productId).QueryRow(&item)
  55. return
  56. }