report_selection.go 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "github.com/rdlucklib/rdluck_tools/paging"
  5. )
  6. type CygxReportSelectionRep struct {
  7. ArticleId int `orm:"column(article_id);pk"description:"报告id"`
  8. Title string `description:"标题"`
  9. Department string `description:"作者"`
  10. PublishDate string `description:"发布时间"`
  11. CreateTime string `description:"创建时间"`
  12. Abstract string `description:"摘要/更新说明"`
  13. UpdateDescription string `description:"更新说明"`
  14. IsRed bool `description:"是否标记红点"`
  15. ReadNum int `description:"阅读次数"`
  16. Periods string `description:"期数"`
  17. MarketStrategy string `description:"市场策略核心逻辑汇总"`
  18. }
  19. type CygxReportSelectionListPublicRep struct {
  20. Paging *paging.PagingItem `description:"分页数据"`
  21. List []*CygxReportSelectionRep
  22. }
  23. type DetailCygxReportSelectionRep struct {
  24. ArticleId int `description:"报告Id"`
  25. Title string `description:"标题"`
  26. Department string `description:"作者"`
  27. PublishDate string `description:"发布时间"`
  28. CreateTime string `description:"创建时间"`
  29. LastUpdatedTime string `description:"最后一次更新时间"`
  30. Periods int `description:"期数"`
  31. VideoUrl string `description:"链接"`
  32. VideoPlaySeconds string `description:"时长"`
  33. VideoName string `description:"音频名称"`
  34. ProductDescription string `description:"产品说明"`
  35. UpdateDescription string `description:"更新说明"`
  36. FocusOn string `description:"近期重点关注方向"`
  37. MarketStrategy string `description:"市场策略核心逻辑汇总"`
  38. ReportLink string `description:"报告链接"`
  39. CeLueArticleId int `description:"策略报告详情"`
  40. VisibleRange int `description:"设置可见范围1全部,0内部"`
  41. }
  42. type ReportSelectionLetailResp struct {
  43. Detail *DetailCygxReportSelectionRep
  44. HasPermission int `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,已提交过申请,4:无该行业权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"`
  45. List []*ReportSelectionChartPermission
  46. ListPermissionSubject []*ReportSelectionChartLogPermission `description:"行业列表"`
  47. IsShow bool `description:"是否展示"`
  48. }
  49. type ReportSelectionChartPermission struct {
  50. PermissionName string `description:"权限名称"`
  51. ChartPermissionId int `description:"权限名称"`
  52. IcoLink string `orm:"column(image_url)"description:"图标链接"`
  53. List []*CygxReportSelectionLogDetail
  54. BodyChartSummary string `description:"行业核心逻辑汇总"`
  55. }
  56. type ReportSelectionChartLogPermission struct {
  57. PermissionName string `description:"权限名称"`
  58. ListSubject []*ReportSelectionChartLogSubjectName `description:"标的列表"`
  59. }
  60. type ReportSelectionChartLogSubjectName struct {
  61. SubjectName string `description:"标的名称"`
  62. IndustrialSubjectId int `description:"标的ID"`
  63. IsNew bool `description:"是否展示新标签"`
  64. }
  65. type CygxReportSelectionLogDetail struct {
  66. IndustrialManagementId string `description:"产业Id"`
  67. IndustrialSubjectId int `description:"标的ID"`
  68. SubjectName string `description:"标的名称"`
  69. IsShowApplyButton bool `description:"是否展示申请路由按钮"`
  70. IsNew bool `description:"是否展示新标签"`
  71. Body string `description:"内容"`
  72. CompanyLabel []string `description:"公司标签"`
  73. Label string `description:"公司标签"`
  74. OverviewArticleId int `description:"综述报告Id"`
  75. IsShowOverviewArticle int `description:"是否展示综述报告 1展示,0隐藏"`
  76. List []*IndustriaReportSelection
  77. }
  78. type IndustriaReportSelection struct {
  79. IndustrialManagementId int `description:"产业Id"`
  80. IndustryName string `description:"产业名称"`
  81. }
  82. type ReportSelectionId struct {
  83. ArticleId int `description:"报告I"`
  84. }
  85. // 获取数量
  86. func GetCygxReportSelectionPublic(condition, tbdb string, pars []interface{}) (count int, err error) {
  87. sqlCount := ` SELECT COUNT(1) AS count FROM ` + tbdb + ` as art WHERE 1= 1 AND art.publish_status = 1 `
  88. if condition != "" {
  89. sqlCount += condition
  90. }
  91. o := orm.NewOrm()
  92. err = o.Raw(sqlCount, pars).QueryRow(&count)
  93. return
  94. }
  95. // 通过ID获取详情
  96. func GetCygxReportSelectionInfoById(articleId int) (item *DetailCygxReportSelectionRep, err error) {
  97. o := orm.NewOrm()
  98. sql := `SELECT * FROM cygx_report_selection WHERE article_id=? AND publish_status = 1 `
  99. err = o.Raw(sql, articleId).QueryRow(&item)
  100. return
  101. }
  102. // 通过期数获取详情
  103. func GetCygxReportSelectionInfoByperiods(periods int) (item *DetailCygxReportSelectionRep, err error) {
  104. o := orm.NewOrm()
  105. sql := `SELECT * FROM cygx_report_selection WHERE periods=? `
  106. err = o.Raw(sql, periods).QueryRow(&item)
  107. return
  108. }
  109. // 列表
  110. func GetReportSelectionListPublic(condition, readSql, tbdb string, pars []interface{}, startSize, pageSize int) (items []*CygxReportSelectionRep, err error) {
  111. o := orm.NewOrm()
  112. sql := `SELECT * ,` + readSql + ` FROM ` + tbdb + ` as art WHERE 1= 1 AND art.publish_status = 1 `
  113. if condition != "" {
  114. sql += condition
  115. }
  116. sql += ` ORDER BY art.publish_date DESC LIMIT ?,?`
  117. _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
  118. return
  119. }
  120. // 列表
  121. func GetReportSelectionListHome(condition, tbdb string, pars []interface{}, startSize, pageSize int) (items []*CygxReportSelectionRep, err error) {
  122. o := orm.NewOrm()
  123. sql := `SELECT * FROM ` + tbdb + ` as art WHERE 1= 1 AND art.publish_status = 1 `
  124. if condition != "" {
  125. sql += condition
  126. }
  127. sql += ` ORDER BY art.publish_date DESC LIMIT ?,?`
  128. _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
  129. return
  130. }
  131. // 列表
  132. func GetReportSelectionlogListAll(articleId int) (items []*CygxReportSelectionLog, err error) {
  133. o := orm.NewOrm()
  134. sql := `SELECT s.subject_name , l.* ,l.company_label as label
  135. FROM
  136. cygx_report_selection_log AS l
  137. INNER JOIN cygx_industrial_subject AS s ON s.industrial_subject_id = l.industrial_subject_id
  138. WHERE l.article_id = ? `
  139. _, err = o.Raw(sql, articleId).QueryRows(&items)
  140. return
  141. }
  142. // 列表
  143. func GetReportSelectionlogSonListAll(articleId, chartPermissionId int) (items []*CygxReportSelectionLogDetail, err error) {
  144. o := orm.NewOrm()
  145. sql := `SELECT l.* ,l.company_label as label
  146. FROM
  147. cygx_report_selection_log AS l
  148. LEFT JOIN cygx_industrial_subject AS s ON s.industrial_subject_id = l.industrial_subject_id
  149. WHERE l.article_id = ? AND l.chart_permission_id =?`
  150. _, err = o.Raw(sql, articleId, chartPermissionId).QueryRows(&items)
  151. return
  152. }
  153. func GetIndustrialByIds(industrialManagementIds string) (items []*IndustriaReportSelection, err error) {
  154. o := orm.NewOrm()
  155. sql := `SELECT * FROM cygx_industrial_management WHERE industrial_management_id IN (` + industrialManagementIds + `)`
  156. _, err = o.Raw(sql).QueryRows(&items)
  157. return
  158. }
  159. type AddReportSelectionStopTimeRep struct {
  160. ArticleId int `description:"文章ID"`
  161. StopTime int `description:"停留时间"`
  162. OutType int `description:"退出方式,1正常退出,2强制关闭"`
  163. Source int `description:"来源,1:深度研究、2:本周研究汇总、3:上周纪要汇总"`
  164. }
  165. // 列表
  166. func GetReportSelectionList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxReportSelectionRep, err error) {
  167. o := orm.NewOrm()
  168. sql := `SELECT * FROM cygx_report_selection as art WHERE 1= 1 AND art.publish_status = 1 `
  169. if condition != "" {
  170. sql += condition
  171. }
  172. sql += ` LIMIT ?,?`
  173. _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
  174. return
  175. }