research_summary_log.go 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. package cygx
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type CygxResearchSummaryLog struct {
  7. ArticleSunId int `orm:"column(article_sun_id);pk"description:"子级报告id"`
  8. ArticleId int `description:"父级报告Id"`
  9. Type string `description:"类型'SDBG:深度报告片篇,’CYDYJY:产业调研纪要’,’SJDP:事件点评,’BZCHJH:本周晨会精华’"`
  10. Sort string `description:"排序"`
  11. ChartPermissionId int `description:"行业ID"`
  12. ChartPermissionSort string `description:"行业排序"`
  13. CreateTime time.Time `description:"创建时间"`
  14. Body string `description:"内容"`
  15. ReportLink string `description:"报告链接"`
  16. LinkArticleId int `description:"报告ID链接"`
  17. }
  18. type CygxResearchSummaryLogRep struct {
  19. Sort string `description:"排序"`
  20. ChartPermissionId int `description:"行业ID"`
  21. ChartPermissionName string `description:"行业名称"`
  22. ChartPermissionSort string `description:"行业排序"`
  23. Body string `description:"内容"`
  24. ReportLink string `description:"报告链接"`
  25. IcoLink string `description:"图标链接"`
  26. }
  27. type AddCygxResearchSummaryLog struct {
  28. Body string `description:"内容"`
  29. ReportLink string `description:"报告链接"`
  30. ChartPermissionSort string `description:"行业排序"`
  31. }
  32. type CygxRSlChartPermission struct {
  33. ChartPermissionId int `description:"行业ID"`
  34. ChartPermissionSort string `description:"行业排序"`
  35. List []*AddCygxResearchSummaryLog
  36. }
  37. type CygxChartPermissionName struct {
  38. ChartPermissionName string `description:"行业名称"`
  39. }
  40. type CygxRSlChartPermissionIco struct {
  41. ChartPermissionId int `description:"行业ID"`
  42. ChartPermissionName string `description:"行业名称"`
  43. ChartPermissionSort string `description:"行业排序"`
  44. IcoLink string `description:"图标链接"`
  45. List []*AddCygxResearchSummaryLog
  46. }
  47. type CygxRSlChartPermissionIcoTmp struct {
  48. ChartPermissionId int `description:"行业ID"`
  49. ChartPermissionName string `description:"行业名称"`
  50. ChartPermissionSort string `description:"行业排序"`
  51. IcoLink string `description:"图标链接"`
  52. BodyChartSummary string `description:"内容"`
  53. List []string
  54. //List make([]string, 0)
  55. }
  56. type CygxRSlChartPermissionIcoTmpList struct {
  57. List []*CygxRSlChartPermissionIcoTmp
  58. }
  59. type CygxRSlFirstList struct {
  60. ListSdbg []*CygxRSlChartPermission `description:"类型——’SDBG:深度报告片篇’"`
  61. SortSdbg string `description:"深度报告排序"`
  62. ListCydyjy []*CygxRSlChartPermission `description:"类型——’CYDYJY:产业调研纪要’"`
  63. SortCydyjy string `description:"产业调研纪要排序"`
  64. ListSsgs []*CygxRSlChartPermission `description:"类型——’SSGS:上市公司调研纪要篇’"`
  65. SortSsgs string `description:"上市公司调研纪要篇排序"`
  66. ListSjdp []*AddCygxResearchSummaryLog `description:"类型——’SJDP:事件点评"`
  67. SortSjdp string `description:"事件点评排序"`
  68. ListBzchjh []*CygxRSlChartPermission `description:"类型——’BZCHJH:本周晨会精华’"`
  69. SortBzchjh string `description:"本周晨会精华排序"`
  70. SortYanx string `description:"研选排序"`
  71. ListYanx []*CygxRSlChartPermission `description:"类型——’YANX:研选’"`
  72. }
  73. func GetCygxResearchSummaryLogRepList(articleId int, typeStr string) (items []*CygxResearchSummaryLogRep, err error) {
  74. o := orm.NewOrmUsingDB("hz_cygx")
  75. sql := `SELECT l.*
  76. FROM cygx_research_summary_log AS l
  77. WHERE 1= 1 AND article_id=? AND type =? GROUP BY l.chart_permission_id `
  78. _, err = o.Raw(sql, articleId, typeStr).QueryRows(&items)
  79. return
  80. }
  81. func GetCygxResearchSummaryLogRepListSon(articleId, chartPermissionId int, typeStr string) (items []*AddCygxResearchSummaryLog, err error) {
  82. o := orm.NewOrmUsingDB("hz_cygx")
  83. sql := `SELECT l.* FROM cygx_research_summary_log AS l
  84. WHERE 1= 1 AND l.article_id=? AND l.chart_permission_id =? AND l.type =? `
  85. _, err = o.Raw(sql, articleId, chartPermissionId, typeStr).QueryRows(&items)
  86. return
  87. }
  88. func GetCygxResearchSummarySjdpList(articleId int, typeStr string) (items []*AddCygxMinutesSummaryLog, err error) {
  89. o := orm.NewOrmUsingDB("hz_cygx")
  90. sql := `SELECT l.* FROM cygx_research_summary_log AS l
  91. WHERE 1= 1 AND l.article_id=? AND l.type =? `
  92. _, err = o.Raw(sql, articleId, typeStr).QueryRows(&items)
  93. return
  94. }
  95. type RSList []*CygxRSlChartPermissionIco
  96. func (m RSList) Len() int {
  97. return len(m)
  98. }
  99. func (m RSList) Less(i, j int) bool {
  100. return m[i].ChartPermissionSort < m[j].ChartPermissionSort
  101. }
  102. func (m RSList) Swap(i, j int) {
  103. m[i], m[j] = m[j], m[i]
  104. }