report_selection.go 8.2 KB

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