rai_serve_bill.go 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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. func GetRaiServeSearchTagRespListBycharId(keywords, charIds string) (items []*RaiServeTagResp, err error) {
  72. o := orm.NewOrmUsingDB("hz_cygx")
  73. sql := `SELECT
  74. 1 AS tag_type,
  75. i.industrial_management_id AS tag_id,
  76. i.industry_name AS tag_name,
  77. i.create_time
  78. FROM
  79. cygx_industrial_management AS i
  80. WHERE
  81. 1 = 1
  82. AND i.chart_permission_id IN ( 19, 20, 21, 22 )
  83. AND i.industry_name LIKE '%` + keywords + `%' UNION ALL
  84. SELECT
  85. 2 AS tag_type,
  86. s.industrial_subject_id AS tag_id,
  87. s.subject_name AS tag_name,
  88. s.create_time
  89. FROM
  90. cygx_industrial_subject AS s
  91. INNER JOIN cygx_industrial_management AS i ON i.industrial_management_id = s.industrial_management_id
  92. WHERE
  93. 1 = 1
  94. AND i.chart_permission_id IN ( 19, 20, 21, 22 )
  95. AND s.subject_name LIKE '%` + keywords + `%'
  96. ORDER BY
  97. create_time ASC `
  98. _, err = o.Raw(sql).QueryRows(&items)
  99. return
  100. }
  101. // 权益服务明细表
  102. type CygxRaiServeBillResp struct {
  103. Content string `comment:"服务内容说明"`
  104. ServeTypeName string `comment:"服务类型"`
  105. Mobile string `comment:"手机号"`
  106. Email string `comment:"邮箱"`
  107. RealName string `comment:"用户实际名称"`
  108. ServeCount float64 `comment:"服务量小计"`
  109. Tag string `comment:"标签,多个用 , 隔开"`
  110. IsKp int `comment:"是否是KP,1:是、0:否"`
  111. ViewTime string `comment:"浏览时间"`
  112. }
  113. type CygxRaiServeBillListResp struct {
  114. Paging *paging.PagingItem `description:"分页数据"`
  115. List []*CygxRaiServeBillResp
  116. }
  117. func GetCygxRaiServeBillCount(condition string, pars []interface{}) (count int, err error) {
  118. o := orm.NewOrmUsingDB("hz_cygx")
  119. sqlCount := ` SELECT COUNT(1) AS count FROM cygx_rai_serve_bill as art WHERE 1= 1 `
  120. if condition != "" {
  121. sqlCount += condition
  122. }
  123. err = o.Raw(sqlCount, pars).QueryRow(&count)
  124. return
  125. }
  126. // 列表
  127. func GetCygxRaiServeBillRespList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxRaiServeBillResp, err error) {
  128. o := orm.NewOrmUsingDB("hz_cygx")
  129. sql := `SELECT * FROM cygx_rai_serve_bill as art WHERE 1= 1 `
  130. if condition != "" {
  131. sql += condition
  132. }
  133. sql += ` ORDER BY bill_id DESC LIMIT ?,? `
  134. _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
  135. return
  136. }