report_mapping.go 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "hongze/hongze_cygxzs/utils"
  5. )
  6. type ReportMappingResp struct {
  7. CategoryId int `description:"分类ID"`
  8. SubCategoryName string `description:"主题名称"`
  9. MatchTypeName string `description:"匹配类型"`
  10. IsRed bool `description:"是否标红"`
  11. }
  12. // 获取策略下面的所有分类
  13. func GetReportMappingStrategyAll() (items []*IndustrialManagementRep, err error) {
  14. o := orm.NewOrmUsingDB("hz_cygx")
  15. sql := `SELECT
  16. match_type_name AS industry_name,
  17. category_id AS industrial_management_id,
  18. chart_permission_id
  19. FROM
  20. cygx_report_mapping
  21. WHERE
  22. report_type = 1
  23. AND chart_permission_name IN ('策略','固收')
  24. ORDER BY
  25. sort ASC `
  26. _, err = o.Raw(sql).QueryRows(&items)
  27. return
  28. }
  29. // 获取策略下面的所有分类
  30. func GetReportMappingStrategyAllGuShou() (items []*IndustrialManagementRep, err error) {
  31. o := orm.NewOrmUsingDB("hz_cygx")
  32. sql := `SELECT
  33. match_type_name AS industry_name,
  34. category_id AS industrial_management_id,
  35. chart_permission_id
  36. FROM
  37. cygx_report_mapping
  38. WHERE
  39. report_type = 1
  40. AND chart_permission_name = ?
  41. ORDER BY
  42. sort ASC `
  43. _, err = o.Raw(sql, utils.GU_SHOU_NAME).QueryRows(&items)
  44. return
  45. }