rai_serve_company.go 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. package cygx
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "github.com/rdlucklib/rdluck_tools/paging"
  5. "time"
  6. )
  7. type CygxRaiServeCompany struct {
  8. ServeCompanyId int `comment:"ServeCompanyId 主键ID"`
  9. CompanyId int `comment:"公司ID"`
  10. CompanyName string `comment:"公司名称"`
  11. CreateTime time.Time `comment:"创建时间"`
  12. Money float64 `comment:"合同金额"`
  13. ServeCoverageRate string `comment:"近四周服务覆盖率"`
  14. SellerId int `comment:"所属销售id"`
  15. SellerName string `comment:"所属销售名称"`
  16. StartDate string `comment:"开始日期"`
  17. EndDate string `comment:"结束日期"`
  18. ShareSeller string `comment:"共享销售"`
  19. ShareSellerId int `comment:"共享销售员id"`
  20. Status string `comment:"客户状态"`
  21. PermissionName string `comment:"权限名"`
  22. }
  23. type CygxRaiServeCompanyResp struct {
  24. CompanyId int `comment:"公司ID"`
  25. CompanyName string `comment:"公司名称"`
  26. IsRed bool `comment:"是否标红"`
  27. Money float64 `comment:"合同金额"`
  28. ServeCoverageRate string `comment:"近四周服务覆盖率"`
  29. SellerId int `comment:"所属销售id"`
  30. SellerName string `comment:"所属销售名称"`
  31. StartDate string `comment:"开始日期"`
  32. EndDate string `comment:"结束日期"`
  33. ShareSeller string `comment:"共享销售"`
  34. ShareSellerId int `comment:"共享销售员id"`
  35. Status string `comment:"客户状态"`
  36. PermissionName string `comment:"权限名"`
  37. ThisWeekAmount int `comment:"本周互动量"`
  38. LastWeekAmount int `comment:"上周互动量"`
  39. TwoWeekAmount int `comment:"上上周互动量"`
  40. ThreeWeekAmount int `comment:"上三周互动量"`
  41. }
  42. type CygxRaiServeCompanyListResp struct {
  43. Paging *paging.PagingItem `description:"分页数据"`
  44. List []*CygxRaiServeCompanyResp
  45. }
  46. func GetCygxRaiServeCompanyCount(condition string, pars []interface{}) (count int, err error) {
  47. sqlCount := ` SELECT COUNT(1) AS count FROM cygx_rai_serve_company as art WHERE 1= 1 `
  48. if condition != "" {
  49. sqlCount += condition
  50. }
  51. o := orm.NewOrmUsingDB("hz_cygx")
  52. err = o.Raw(sqlCount, pars).QueryRow(&count)
  53. return
  54. }
  55. // 列表
  56. func GetCygxRaiServeCompanyList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxRaiServeCompany, err error) {
  57. o := orm.NewOrmUsingDB("hz_cygx")
  58. sql := `SELECT * FROM cygx_rai_serve_company as art WHERE 1= 1 `
  59. if condition != "" {
  60. sql += condition
  61. }
  62. sql += ` LIMIT ?,?`
  63. _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
  64. return
  65. }