report_selection_log.go 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. package cygx
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type CygxReportSelectionLog struct {
  7. ArticleSunId int `orm:"column(article_sun_id);pk"description:"子级报告id"`
  8. ArticleId int `description:"父级报告Id"`
  9. ChartPermissionId int `description:"行业ID"`
  10. CreateTime time.Time `description:"创建时间"`
  11. Body string `description:"内容"`
  12. IndustrialSubjectId string `description:"标的ID"`
  13. SubjectName string `description:"标的名称"`
  14. IndustrialManagementId string `description:"产业资源包Id 多个用 , 隔开"`
  15. CompanyLabel string `description:"公司标签多个用{|}隔开"`
  16. OverviewArticleId int `description:"关联的综述报告ID"`
  17. IsNew int `description:"是否为New标签"`
  18. IsShowOverviewArticle int `description:"是否展示综述报告 1展示,0隐藏"`
  19. }
  20. type CygxReportSelectionLogRep struct {
  21. Sort string `description:"排序"`
  22. ChartPermissionId int `description:"行业ID"`
  23. ChartPermissionName string `description:"行业名称"`
  24. ChartPermissionSort string `description:"行业排序"`
  25. Body string `description:"内容"`
  26. ReportLink string `description:"报告链接"`
  27. IcoLink string `description:"图标链接"`
  28. }
  29. type AddCygxReportSelectionLog struct {
  30. ChartPermissionId int `description:"行业ID"`
  31. IndustrialSubjectId string `description:"标的ID"`
  32. SubjectName string `description:"标的名称"`
  33. IndustrialSubjectName string `description:"标的ID"`
  34. Body string `description:"内容"`
  35. IndustrialManagementId string `description:"产业资源包Id 多个用 , 隔开"`
  36. IndustrialManagementName string `description:"产业资源包Id 多个用 , 隔开"`
  37. CompanyLabel []string `description:"公司标签"`
  38. Label string `description:"公司标签"`
  39. OverviewArticleId int `description:"综述报告Id"`
  40. IsNew int `description:"是否为New标签"`
  41. IsShowOverviewArticle int `description:"是否展示综述报告 1展示,0隐藏"`
  42. }
  43. type CygxReportSelectionLogResp struct {
  44. ChartPermissionId int `description:"行业ID"`
  45. IndustrialSubjectId string `description:"标的ID"`
  46. SubjectName string `description:"标的名称"`
  47. IndustrialSubjectName string `description:"标的ID"`
  48. Body string `description:"内容"`
  49. IndustrialManagementId string `description:"产业资源包Id 多个用 , 隔开"`
  50. IndustrialManagementName string `description:"产业资源包Id 多个用 , 隔开"`
  51. CompanyLabel []string `description:"公司标签"`
  52. Label string `description:"公司标签"`
  53. OverviewArticleId int `description:"综述报告Id"`
  54. OverviewArticleTitle string `description:"综述报告标题"`
  55. IsNew int `description:"是否为New标签"`
  56. IsShowOverviewArticle int `description:"是否展示综述报告 1展示,0隐藏"`
  57. ChartPermissionSort int `description:"品种排序"`
  58. }
  59. type CygxReportSelectionChart struct {
  60. ChartPermissionId int `description:"行业ID"`
  61. ChartPermissionName string `description:"行业名称"`
  62. List []*CygxReportSelectionLogResp `description:"列表内容’"`
  63. BodyChartSummary string `description:"行业核心逻辑汇总"`
  64. }
  65. func GetCygxReportSelectionLogRepListSon(articleId, chartPermissionId int) (items []*CygxReportSelectionLogResp, err error) {
  66. o := orm.NewOrmUsingDB("hz_cygx")
  67. sql := `SELECT
  68. l.*, l.company_label as label,
  69. l.subject_name as industrial_subject_name,
  70. ( SELECT GROUP_CONCAT( DISTINCT m.industry_name SEPARATOR ',' ) AS sellerName FROM cygx_industrial_management AS m WHERE m.industrial_management_id IN ( l.industrial_management_id ) ) AS industrial_management_name
  71. FROM
  72. cygx_report_selection_log AS l
  73. LEFT JOIN cygx_industrial_subject AS s ON s.industrial_subject_id = l.industrial_subject_id
  74. WHERE 1= 1 AND l.article_id=? AND l.chart_permission_id =? `
  75. _, err = o.Raw(sql, articleId, chartPermissionId).QueryRows(&items)
  76. return
  77. }
  78. func GetCygxReportSelectionSjdpList(articleId int, typeStr string) (items []*CygxReportSelectionLogRep, err error) {
  79. o := orm.NewOrmUsingDB("hz_cygx")
  80. sql := `SELECT l.* FROM cygx_research_summary_log AS l
  81. WHERE 1= 1 AND l.article_id=? AND l.type =? `
  82. _, err = o.Raw(sql, articleId, typeStr).QueryRows(&items)
  83. return
  84. }
  85. type CygxReportSelectionLoglist struct {
  86. ArticleSunId int `description:"子级报告id"`
  87. ArticleId int `description:"父级报告Id"`
  88. ChartPermissionId int `description:"行业ID"`
  89. PermissionName string `description:"行业ID"`
  90. CreateTime time.Time `description:"创建时间"`
  91. Body string `description:"内容"`
  92. IndustrialSubjectId string `description:"标的ID"`
  93. IndustrialManagementId string `description:"产业资源包Id 多个用 , 隔开"`
  94. SubjectName string `description:"标的名称"`
  95. IcoLink string `orm:"column(image_url)"description:"图标链接"`
  96. OverviewArticleId int `description:"关联的综述报告ID"`
  97. IsNew int `description:"是否为New标签"`
  98. }
  99. // 列表
  100. func GetReportSelectionlogListAll(articleId int) (items []*CygxReportSelectionLoglist, err error) {
  101. o := orm.NewOrmUsingDB("hz_cygx")
  102. sql := `SELECT l.*
  103. FROM
  104. cygx_report_selection_log AS l
  105. INNER JOIN cygx_industrial_subject AS s ON s.industrial_subject_id = l.industrial_subject_id
  106. WHERE l.article_id = ? `
  107. _, err = o.Raw(sql, articleId).QueryRows(&items)
  108. return
  109. }