package models import ( "github.com/beego/beego/v2/client/orm" "github.com/rdlucklib/rdluck_tools/paging" ) type CygxReportSelectionRep struct { ArticleId int `orm:"column(article_id);pk"description:"报告id"` Title string `description:"标题"` Department string `description:"作者"` PublishDate string `description:"发布时间"` CreateTime string `description:"创建时间"` Abstract string `description:"摘要/更新说明"` UpdateDescription string `description:"更新说明"` IsRed bool `description:"是否标记红点"` ReadNum int `description:"阅读次数"` Periods string `description:"期数"` MarketStrategy string `description:"市场策略核心逻辑汇总"` Pv int `description:"pv"` } type CygxReportSelectionListPublicRep struct { Paging *paging.PagingItem `description:"分页数据"` List []*CygxReportSelectionRep } type DetailCygxReportSelectionRep struct { ArticleId int `description:"报告Id"` Title string `description:"标题"` Department string `description:"作者"` PublishDate string `description:"发布时间"` CreateTime string `description:"创建时间"` LastUpdatedTime string `description:"最后一次更新时间"` Periods int `description:"期数"` VideoUrl string `description:"链接"` VideoPlaySeconds string `description:"时长"` VideoName string `description:"音频名称"` ProductDescription string `description:"产品说明"` UpdateDescription string `description:"更新说明"` FocusOn string `description:"近期重点关注方向"` MarketStrategy string `description:"市场策略核心逻辑汇总"` ReportLink string `description:"报告链接"` CeLueArticleId int `description:"策略报告详情"` VisibleRange int `description:"设置可见范围1全部,0内部"` } type ReportSelectionLetailResp struct { Detail *DetailCygxReportSelectionRep HasPermission int `description:"1:有该行业权限,正常展示,2:无该行业权限,不存在权益客户下,3:无该品类权限,已提交过申请,4:无该行业权限,未提交过申请,5:潜在客户,未提交过申请,6:潜在客户,已提交过申请"` List []*ReportSelectionChartPermission ListPermissionSubject []*ReportSelectionChartLogPermission `description:"行业列表"` IsShow bool `description:"是否展示"` } type ReportSelectionChartPermission struct { PermissionName string `description:"权限名称"` ChartPermissionId int `description:"权限名称"` IcoLink string `orm:"column(image_url)"description:"图标链接"` List []*CygxReportSelectionLogDetail BodyChartSummary string `description:"行业核心逻辑汇总"` } type ReportSelectionChartLogPermission struct { PermissionName string `description:"权限名称"` ListSubject []*ReportSelectionChartLogSubjectName `description:"标的列表"` } type ReportSelectionChartLogSubjectName struct { SubjectName string `description:"标的名称"` IndustrialSubjectId int `description:"标的ID"` IsNew bool `description:"是否展示新标签"` } type CygxReportSelectionLogDetail struct { IndustrialManagementId string `description:"产业Id"` IndustrialSubjectId int `description:"标的ID"` SubjectName string `description:"标的名称"` IsShowApplyButton bool `description:"是否展示申请路由按钮"` IsNew bool `description:"是否展示新标签"` Body string `description:"内容"` CompanyLabel []string `description:"公司标签"` Label string `description:"公司标签"` OverviewArticleId int `description:"综述报告Id"` IsShowOverviewArticle int `description:"是否展示综述报告 1展示,0隐藏"` List []*IndustriaReportSelection } type IndustriaReportSelection struct { IndustrialManagementId int `description:"产业Id"` IndustryName string `description:"产业名称"` } type ReportSelectionId struct { ArticleId int `description:"报告I"` } // 获取数量 func GetCygxReportSelectionPublic(condition, tbdb string, pars []interface{}) (count int, err error) { sqlCount := ` SELECT COUNT(1) AS count FROM ` + tbdb + ` as art WHERE 1= 1 AND art.publish_status = 1 ` if condition != "" { sqlCount += condition } o := orm.NewOrm() err = o.Raw(sqlCount, pars).QueryRow(&count) return } // 通过ID获取详情 func GetCygxReportSelectionInfoById(articleId int) (item *DetailCygxReportSelectionRep, err error) { o := orm.NewOrm() sql := `SELECT * FROM cygx_report_selection WHERE article_id=? AND publish_status = 1 ` err = o.Raw(sql, articleId).QueryRow(&item) return } // 通过期数获取详情 func GetCygxReportSelectionInfoByperiods(periods int) (item *DetailCygxReportSelectionRep, err error) { o := orm.NewOrm() sql := `SELECT * FROM cygx_report_selection WHERE periods=? ` err = o.Raw(sql, periods).QueryRow(&item) return } // 列表 func GetReportSelectionListPublic(condition, readSql, tbdb string, pars []interface{}, startSize, pageSize int) (items []*CygxReportSelectionRep, err error) { o := orm.NewOrm() sql := `SELECT * ,` + readSql + ` FROM ` + tbdb + ` as art WHERE 1= 1 AND art.publish_status = 1 ` if condition != "" { sql += condition } sql += ` ORDER BY art.publish_date DESC LIMIT ?,?` _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items) return } // 列表 func GetReportSelectionListHome(condition, tbdb string, pars []interface{}, startSize, pageSize int) (items []*CygxReportSelectionRep, err error) { o := orm.NewOrm() sql := `SELECT * FROM ` + tbdb + ` as art WHERE 1= 1 AND art.publish_status = 1 ` if condition != "" { sql += condition } sql += ` ORDER BY art.publish_date DESC LIMIT ?,?` _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items) return } // 列表 func GetReportSelectionlogListAll(articleId int) (items []*CygxReportSelectionLog, err error) { o := orm.NewOrm() sql := `SELECT s.subject_name , l.* ,l.company_label as label FROM cygx_report_selection_log AS l INNER JOIN cygx_industrial_subject AS s ON s.industrial_subject_id = l.industrial_subject_id WHERE l.article_id = ? ` _, err = o.Raw(sql, articleId).QueryRows(&items) return } // 列表 func GetReportSelectionlogSonListAll(articleId, chartPermissionId int) (items []*CygxReportSelectionLogDetail, err error) { o := orm.NewOrm() sql := `SELECT l.* ,l.company_label as label FROM cygx_report_selection_log AS l LEFT JOIN cygx_industrial_subject AS s ON s.industrial_subject_id = l.industrial_subject_id WHERE l.article_id = ? AND l.chart_permission_id =?` _, err = o.Raw(sql, articleId, chartPermissionId).QueryRows(&items) return } func GetIndustrialByIds(industrialManagementIds string) (items []*IndustriaReportSelection, err error) { o := orm.NewOrm() sql := `SELECT * FROM cygx_industrial_management WHERE industrial_management_id IN (` + industrialManagementIds + `)` _, err = o.Raw(sql).QueryRows(&items) return } type AddReportSelectionStopTimeRep struct { ArticleId int `description:"文章ID"` StopTime int `description:"停留时间"` OutType int `description:"退出方式,1正常退出,2强制关闭"` Source int `description:"来源,1:深度研究、2:本周研究汇总、3:上周纪要汇总"` } // 列表 func GetReportSelectionList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxReportSelectionRep, err error) { o := orm.NewOrm() sql := `SELECT * FROM cygx_report_selection as art WHERE 1= 1 AND art.publish_status = 1 ` if condition != "" { sql += condition } sql += ` LIMIT ?,?` _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items) return }