rai_serve_bill.go 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. package cygx
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "github.com/rdlucklib/rdluck_tools/paging"
  5. )
  6. type RaiServeTypeResp struct {
  7. ServeTypeId int `description:"服务类型id"`
  8. ServeTypeName string `description:"服务类型名称"`
  9. }
  10. type RaiServeTypeListResp struct {
  11. List []*RaiServeTypeResp
  12. }
  13. // 服务类型列表
  14. func GetRaiServeTypeRespList(condition string) (items []*RaiServeTypeResp, err error) {
  15. o := orm.NewOrmUsingDB("hz_cygx")
  16. sql := `SELECT * FROM cygx_rai_serve_type WHERE 1= 1 `
  17. if condition != "" {
  18. sql += condition
  19. }
  20. sql += ` ORDER BY sort DESC LIMIT 100 `
  21. _, err = o.Raw(sql).QueryRows(&items)
  22. return
  23. }
  24. type RaiServeTagResp struct {
  25. TagType int `description:"标签类型"`
  26. TagId int `description:"标签ID"`
  27. TagName string `description:"标签名称"`
  28. Md5Key string `description:"加密key,前端找参数当唯一索引值使用"`
  29. }
  30. type RaiServeTagListResp struct {
  31. List []*RaiServeTagResp
  32. }
  33. type RaiServeCoverageRateResp struct {
  34. //List []string
  35. ThisWeekAmount string `comment:"本周互动量"`
  36. LastWeekAmount string `comment:"上周互动量"`
  37. TwoWeekAmount string `comment:"上上周互动量"`
  38. ThreeWeekAmount string `comment:"上三周互动量"`
  39. }
  40. // 服务类型列表
  41. func GetRaiServeSearchTagRespList(keywords string) (items []*RaiServeTagResp, err error) {
  42. o := orm.NewOrmUsingDB("hz_cygx")
  43. sql := `SELECT
  44. 1 AS tag_type,
  45. i.industrial_management_id AS tag_id,
  46. i.industry_name AS tag_name,
  47. i.create_time
  48. FROM
  49. cygx_industrial_management AS i
  50. WHERE
  51. 1 = 1
  52. AND i.chart_permission_id IN ( 19, 20, 21, 22 )
  53. AND i.industry_name LIKE '%` + keywords + `%' UNION ALL
  54. SELECT
  55. 2 AS tag_type,
  56. s.industrial_subject_id AS tag_id,
  57. s.subject_name AS tag_name,
  58. s.create_time
  59. FROM
  60. cygx_industrial_subject AS s
  61. INNER JOIN cygx_industrial_management AS i ON i.industrial_management_id = s.industrial_management_id
  62. WHERE
  63. 1 = 1
  64. AND i.chart_permission_id IN ( 19, 20, 21, 22 )
  65. AND s.subject_name LIKE '%` + keywords + `%'
  66. ORDER BY
  67. create_time ASC `
  68. _, err = o.Raw(sql).QueryRows(&items)
  69. return
  70. }
  71. // 权益服务明细表
  72. type CygxRaiServeBillResp struct {
  73. Content string `comment:"服务内容说明"`
  74. ServeTypeName string `comment:"服务类型"`
  75. Mobile string `comment:"手机号"`
  76. Email string `comment:"邮箱"`
  77. RealName string `comment:"用户实际名称"`
  78. ServeCount float64 `comment:"服务量小计"`
  79. Tag string `comment:"标签,多个用 , 隔开"`
  80. IsKp int `comment:"是否是KP,1:是、0:否"`
  81. ViewTime string `comment:"浏览时间"`
  82. }
  83. type CygxRaiServeBillListResp struct {
  84. Paging *paging.PagingItem `description:"分页数据"`
  85. List []*CygxRaiServeBillResp
  86. }
  87. func GetCygxRaiServeBillCount(condition string, pars []interface{}) (count int, err error) {
  88. o := orm.NewOrmUsingDB("hz_cygx")
  89. sqlCount := ` SELECT COUNT(1) AS count FROM cygx_rai_serve_bill as art WHERE 1= 1 `
  90. if condition != "" {
  91. sqlCount += condition
  92. }
  93. err = o.Raw(sqlCount, pars).QueryRow(&count)
  94. return
  95. }
  96. // 列表
  97. func GetCygxRaiServeBillRespList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxRaiServeBillResp, err error) {
  98. o := orm.NewOrmUsingDB("hz_cygx")
  99. sql := `SELECT * FROM cygx_rai_serve_bill as art WHERE 1= 1 `
  100. if condition != "" {
  101. sql += condition
  102. }
  103. sql += ` ORDER BY bill_id DESC LIMIT ?,? `
  104. _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
  105. return
  106. }