rai_serve_bill.go 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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 ChekChartPermissionNameResp struct {
  31. ChartPermissionName string `description:"权限名称"`
  32. Belong bool `description:"权限名称"`
  33. }
  34. type RaiServeTagListResp struct {
  35. List []*RaiServeTagResp
  36. }
  37. type RaiServeCoverageRateResp struct {
  38. //List []string
  39. ThisWeekAmount string `comment:"本周互动量"`
  40. LastWeekAmount string `comment:"上周互动量"`
  41. TwoWeekAmount string `comment:"上上周互动量"`
  42. ThreeWeekAmount string `comment:"上三周互动量"`
  43. }
  44. // 服务类型列表
  45. func GetRaiServeSearchTagRespList(keywords string) (items []*RaiServeTagResp, err error) {
  46. o := orm.NewOrmUsingDB("hz_cygx")
  47. sql := `SELECT
  48. 1 AS tag_type,
  49. i.industrial_management_id AS tag_id,
  50. i.industry_name AS tag_name,
  51. i.create_time
  52. FROM
  53. cygx_industrial_management AS i
  54. WHERE
  55. 1 = 1
  56. AND i.chart_permission_id IN ( 19, 20, 21, 22 )
  57. AND (i.industry_name LIKE '%` + keywords + `%' ) UNION ALL
  58. SELECT
  59. 2 AS tag_type,
  60. s.industrial_subject_id AS tag_id,
  61. s.subject_name AS tag_name,
  62. s.create_time
  63. FROM
  64. cygx_industrial_subject AS s
  65. INNER JOIN cygx_industrial_management AS i ON i.industrial_management_id = s.industrial_management_id
  66. WHERE
  67. 1 = 1
  68. AND i.chart_permission_id IN ( 19, 20, 21, 22 )
  69. AND ( s.subject_name LIKE '%` + keywords + `%')
  70. ORDER BY
  71. create_time ASC `
  72. _, err = o.Raw(sql).QueryRows(&items)
  73. return
  74. }
  75. func GetRaiServeSearchTagRespListBycharId(keywords, charIds, conditionindustrial, conditionsubject string) (items []*RaiServeTagResp, err error) {
  76. o := orm.NewOrmUsingDB("hz_cygx")
  77. sql := `SELECT
  78. 1 AS tag_type,
  79. i.industrial_management_id AS tag_id,
  80. i.industry_name AS tag_name,
  81. i.create_time
  82. FROM
  83. cygx_industrial_management AS i
  84. WHERE
  85. 1 = 1
  86. AND i.chart_permission_id IN (` + charIds + ` )
  87. AND (i.industry_name LIKE '%` + keywords + `%' ` + conditionindustrial + ` ) UNION ALL
  88. SELECT
  89. 2 AS tag_type,
  90. s.industrial_subject_id AS tag_id,
  91. s.subject_name AS tag_name,
  92. s.create_time
  93. FROM
  94. cygx_industrial_subject AS s
  95. INNER JOIN cygx_industrial_management AS i ON i.industrial_management_id = s.industrial_management_id
  96. WHERE
  97. 1 = 1
  98. AND i.chart_permission_id IN (` + charIds + ` )
  99. AND ( s.subject_name LIKE '%` + keywords + `%' ` + conditionsubject + ` )
  100. ORDER BY
  101. create_time ASC `
  102. _, err = o.Raw(sql).QueryRows(&items)
  103. return
  104. }
  105. // 权益服务明细表
  106. type CygxRaiServeBillResp struct {
  107. Content string `comment:"服务内容说明"`
  108. ServeTypeName string `comment:"服务类型"`
  109. Mobile string `comment:"手机号"`
  110. Email string `comment:"邮箱"`
  111. RealName string `comment:"用户实际名称"`
  112. ServeCount float64 `comment:"服务量小计"`
  113. Tag string `comment:"标签,多个用 , 隔开"`
  114. IsKp int `comment:"是否是KP,1:是、0:否"`
  115. ViewTime string `comment:"浏览时间"`
  116. }
  117. type CygxRaiServeBillListResp struct {
  118. Paging *paging.PagingItem `description:"分页数据"`
  119. List []*CygxRaiServeBillResp
  120. }
  121. func GetCygxRaiServeBillCount(condition string, pars []interface{}) (count int, err error) {
  122. o := orm.NewOrmUsingDB("hz_cygx")
  123. sqlCount := ` SELECT COUNT(1) AS count FROM cygx_rai_serve_bill as art WHERE 1= 1 `
  124. if condition != "" {
  125. sqlCount += condition
  126. }
  127. err = o.Raw(sqlCount, pars).QueryRow(&count)
  128. return
  129. }
  130. // 列表
  131. func GetCygxRaiServeBillRespList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxRaiServeBillResp, err error) {
  132. o := orm.NewOrmUsingDB("hz_cygx")
  133. sql := `SELECT * FROM cygx_rai_serve_bill as art WHERE 1= 1 `
  134. if condition != "" {
  135. sql += condition
  136. }
  137. sql += ` ORDER BY bill_id DESC LIMIT ?,? `
  138. _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
  139. return
  140. }