report_selection.go 8.8 KB

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