company_product.go 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package company_product
  2. import (
  3. "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. LoseReason string `description:"流失原因"`
  31. LossTime time.Time `description:"流失时间"`
  32. CompanyType string `description:"客户类型"`
  33. }
  34. func GetCompanyProductByCompanyIdAndProductId(companyId, productId int) (item *CompanyProduct, err error) {
  35. o := orm.NewOrm()
  36. sql := `SELECT b.* FROM company AS a
  37. INNER JOIN company_product AS b ON a.company_id=b.company_id
  38. WHERE a.company_id=? AND b.product_id=? LIMIT 1 `
  39. err = o.Raw(sql, companyId, productId).QueryRow(&item)
  40. return
  41. }