rai_serve_week_bill.go 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. package cygx
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type CygxRaiServeWeekBill struct {
  7. ServeWeekBillId int `orm:"column(serve_week_bill_id);pk" description:"服务周账单ID"`
  8. CompanyId int `comment:"公司ID"`
  9. CompanyName string `comment:"公司名称"`
  10. UserTotal int `comment:"用户数量"`
  11. WeekServeCount float64 `comment:"周度服务量总计"`
  12. CoverageRate float64 `comment:"覆盖率"`
  13. WeekStartDate string `comment:"周一开始日期"`
  14. WeekEndDate string `comment:"周日结束日期"`
  15. CreateTime time.Time `comment:"创建时间"`
  16. ModifyTime time.Time `comment:"修改时间"`
  17. }
  18. // 最近四周覆盖率列表
  19. func GetCygxRaiServeBillListWeek4(companyId int) (items []*CygxRaiServeWeekBill, err error) {
  20. o := orm.NewOrmUsingDB("hz_cygx")
  21. sql := `SELECT * FROM cygx_rai_serve_week_bill WHERE company_id = ? ORDER BY week_start_date DESC LIMIT 4 `
  22. _, err = o.Raw(sql, companyId).QueryRows(&items)
  23. return
  24. }
  25. // 权益服务明细表
  26. type CygxRaiCompanyUserBill struct {
  27. BillId int `orm:"column(bill_id);pk" description:"服务明细主键ID"`
  28. Content string `comment:"服务内容说明"`
  29. ServeTypeId int `comment:"服务类型ID"`
  30. ServeTypeName string `comment:"服务类型"`
  31. UserId int `comment:"用户ID"`
  32. Mobile string `comment:"手机号"`
  33. Email string `comment:"邮箱"`
  34. CompanyId int `comment:"公司ID"`
  35. CompanyName string `comment:"公司名称"`
  36. RealName string `comment:"用户实际名称"`
  37. RegisterPlatform int `comment:"来源 1小程序,2:网页"`
  38. ServeCount float64 `comment:"服务量小计"`
  39. IsKp int `comment:"是否是KP,1:是、0:否"`
  40. SourceId int `comment:"来源ID"`
  41. Source string `comment:"来源 "`
  42. WeekStartDate string `comment:"周一开始日期"`
  43. WeekEndDate string `comment:"周日结束日期"`
  44. ChartPermissionId int `description:"行业id"`
  45. ChartPermissionName string `description:"行业名称"`
  46. CreateTime time.Time `comment:"创建时间"`
  47. ViewTime string `comment:"浏览时间"`
  48. ViewTimes time.Time `comment:"浏览时间"`
  49. }
  50. // 列表
  51. func GetCygxRaiCompanyUserBillListAll(condition string, pars []interface{}) (items []*CygxRaiCompanyUserBill, err error) {
  52. if condition == "" {
  53. return
  54. }
  55. o := orm.NewOrmUsingDB("hz_cygx")
  56. sql := `SELECT company_id ,serve_count ,view_time as view_time FROM cygx_rai_company_user_bill WHERE 1= 1 `
  57. if condition != "" {
  58. sql += condition
  59. }
  60. _, err = o.Raw(sql, pars).QueryRows(&items)
  61. return
  62. }