company_product.go 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package company_product
  2. import (
  3. "github.com/rdlucklib/rdluck_tools/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. ApproveStatus string `description:"审批状态:'审批中','通过','驳回'"`
  24. FreezeTime time.Time `description:"冻结时间"`
  25. Remark string `description:"备注信息"`
  26. CreateTime time.Time `description:"创建时间"`
  27. ModifyTime time.Time `description:"修改时间"`
  28. StartDate string `description:"开始日期"`
  29. EndDate string `description:"结束日期"`
  30. ContractEndDate time.Time `description:"合同结束日期"`
  31. LoseReason string `description:"流失原因"`
  32. LossTime time.Time `description:"流失时间"`
  33. CompanyType string `description:"客户类型"`
  34. PackageType int `description:"套餐类型,0:无,1:大套餐,2:小套餐"`
  35. IsFormal int `description:"是否已经转正式,0是没有转正式,1是已经转过正式"`
  36. }
  37. func GetCompanyProductByCompanyIdAndProductId(companyId, productId int) (item *CompanyProduct, err error) {
  38. o := orm.NewOrm()
  39. sql := `SELECT b.* FROM company AS a
  40. INNER JOIN company_product AS b ON a.company_id=b.company_id
  41. WHERE a.company_id=? AND b.product_id=? LIMIT 1 `
  42. err = o.Raw(sql, companyId, productId).QueryRow(&item)
  43. return
  44. }
  45. //更新客户产品信息
  46. func (companyProduct *CompanyProduct) Update(cols []string) (err error) {
  47. o := orm.NewOrm()
  48. _, err = o.Update(companyProduct, cols...)
  49. return
  50. }