rai_serve_company.go 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. IsUserMaker int `comment:"近四周之内是否包含决策人"`
  23. }
  24. type CygxRaiServeCompanyResp struct {
  25. CompanyId int `comment:"公司ID"`
  26. CompanyName string `comment:"公司名称"`
  27. IsUserMaker int `description:"近四周之内是否包含决策人互动过 ,0否,1是"`
  28. Money float64 `comment:"合同金额"`
  29. ServeCoverageRate string `comment:"近四周服务覆盖率"`
  30. SellerId int `comment:"所属销售id"`
  31. SellerName string `comment:"所属销售名称"`
  32. StartDate string `comment:"开始日期"`
  33. EndDate string `comment:"结束日期"`
  34. ShareSeller string `comment:"共享销售"`
  35. ShareSellerId int `comment:"共享销售员id"`
  36. Status string `comment:"客户状态"`
  37. PermissionName string `comment:"权限名"`
  38. ThisWeekAmount float64 `comment:"本周互动量"`
  39. LastWeekAmount float64 `comment:"上周互动量"`
  40. TwoWeekAmount float64 `comment:"上上周互动量"`
  41. ThreeWeekAmount float64 `comment:"上三周互动量"`
  42. }
  43. type CygxRaiServeCompanyListResp struct {
  44. Paging *paging.PagingItem `description:"分页数据"`
  45. List []*CygxRaiServeCompanyResp
  46. }
  47. func GetCygxRaiServeCompanyCount(condition string, pars []interface{}) (count int, err error) {
  48. sqlCount := ` SELECT COUNT(1) AS count FROM cygx_rai_serve_company as art WHERE 1= 1 `
  49. if condition != "" {
  50. sqlCount += condition
  51. }
  52. o := orm.NewOrmUsingDB("hz_cygx")
  53. err = o.Raw(sqlCount, pars).QueryRow(&count)
  54. return
  55. }
  56. // 列表
  57. func GetCygxRaiServeCompanyList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxRaiServeCompany, err error) {
  58. o := orm.NewOrmUsingDB("hz_cygx")
  59. sql := `SELECT * FROM cygx_rai_serve_company as art WHERE 1= 1 `
  60. if condition != "" {
  61. sql += condition
  62. }
  63. sql += ` LIMIT ?,?`
  64. _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
  65. return
  66. }