rai_serve_bill.go 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. package cygx
  2. import "github.com/beego/beego/v2/client/orm"
  3. type RaiServeTypeResp struct {
  4. ServeTypeId int `description:"服务类型id"`
  5. ServeTypeName string `description:"服务类型名称"`
  6. }
  7. type RaiServeTypeListResp struct {
  8. List []*RaiServeTypeResp
  9. }
  10. // 服务类型列表
  11. func GetRaiServeTypeRespList(condition string) (items []*RaiServeTypeResp, err error) {
  12. o := orm.NewOrmUsingDB("hz_cygx")
  13. sql := `SELECT * FROM cygx_rai_serve_type WHERE 1= 1 `
  14. if condition != "" {
  15. sql += condition
  16. }
  17. sql += ` ORDER BY sort DESC LIMIT 100 `
  18. _, err = o.Raw(sql).QueryRows(&items)
  19. return
  20. }
  21. type RaiServeTagResp struct {
  22. TagType int `description:"标签类型"`
  23. TagId int `description:"标签ID"`
  24. TagName string `description:"标签名称"`
  25. }
  26. type RaiServeTagListResp struct {
  27. List []*RaiServeTagResp
  28. }
  29. // 服务类型列表
  30. func GetRaiServeSearchTagRespList(keywords string) (items []*RaiServeTagResp, err error) {
  31. o := orm.NewOrmUsingDB("hz_cygx")
  32. sql := `SELECT
  33. 1 AS tag_type,
  34. i.industrial_management_id AS tag_id,
  35. i.industry_name AS tag_name,
  36. i.create_time
  37. FROM
  38. cygx_industrial_management AS i
  39. WHERE
  40. 1 = 1
  41. AND i.chart_permission_id IN ( 19, 20, 21, 22 )
  42. AND i.industry_name LIKE '%` + keywords + `%' UNION ALL
  43. SELECT
  44. 2 AS tag_type,
  45. s.industrial_subject_id AS tag_id,
  46. s.subject_name AS tag_name,
  47. s.create_time
  48. FROM
  49. cygx_industrial_subject AS s
  50. INNER JOIN cygx_industrial_management AS i ON i.industrial_management_id = s.industrial_management_id
  51. WHERE
  52. 1 = 1
  53. AND i.chart_permission_id IN ( 19, 20, 21, 22 )
  54. AND s.subject_name LIKE '%` + keywords + `%'
  55. ORDER BY
  56. create_time ASC `
  57. _, err = o.Raw(sql).QueryRows(&items)
  58. return
  59. }