1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- package models
- import (
- "rdluck_tools/orm"
- )
- type ReportMapping struct {
- CategoryId int `description:"分类ID"`
- SubCategoryName string `description:"主题"`
- MathTypeName string `description:"分类名称"`
- IsRed bool `description:"是否标红"`
- }
- type ReportMappingHome struct {
- CategoryId int `description:"分类ID"`
- SubCategoryName string `description:"主题名称"`
- MatchTypeName string `description:"匹配类型"`
- IsRed bool `description:"是否标红"`
- }
- type TradeReportMapping struct {
- CategoryId int `description:"分类ID"`
- SubCategoryName string `description:"主题名称"`
- MatchTypeName string `description:"匹配类型"`
- IsRed bool `description:"是否标红"`
- UpdateTime string `description:"更新时间"`
- Readnum int `description:"阅读数量"`
- }
- type ReportMappingResp struct {
- List []*ReportMapping
- }
- type ReportMappingHomeResp struct {
- List []*ReportMappingHome
- }
- type TradeReportMappingResp struct {
- List []*TradeReportMapping
- }
- //获取策略下面的所有分类
- func GetReportMappingStrategyAll() (items []*ReportMapping, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM cygx_report_mapping WHERE report_type=1 AND chart_permission_id=23 ORDER BY sort ASC `
- _, err = o.Raw(sql).QueryRows(&items)
- return
- }
- //获取策略下面的所有分类
- func GetReportMappingStrategyHomeAll() (items []*ReportMappingHome, err error) {
- o := orm.NewOrm()
- sql := `SELECT
- re.category_id,re.sub_category_name,re.match_type_name
- FROM
- cygx_report_mapping AS re
- INNER JOIN cygx_article AS art ON art.category_id = re.category_id
- WHERE
- re.report_type = 1
- AND re.chart_permission_id = 23
- GROUP BY
- re.match_type_name
- ORDER BY
- sort DESC , art.publish_date DESC`
- _, err = o.Raw(sql).QueryRows(&items)
- return
- }
- //行业列表
- func GetTradeAll(uid, ChartPermissionId int) (items []*TradeReportMapping, err error) {
- o := orm.NewOrm()
- //sql := `SELECT * FROM cygx_report_mapping WHERE chart_permission_id = ? AND report_type = 1;`
- sql := `SELECT
- art.article_id,art.publish_date as update_time ,re.category_id,re.sub_category_name,( SELECT COUNT( 1 ) FROM cygx_article_history_record AS rec WHERE rec.user_id = ? AND rec.article_id = art.article_id ) AS readnum
- FROM
- cygx_report_mapping as re
- INNER JOIN cygx_article as art ON re.category_id = art.category_id
- WHERE
- re.chart_permission_id = ?
- AND re.report_type = 1
- ORDER BY art.publish_date DESC
- LIMIT 0,1`
- _, err = o.Raw(sql, uid, ChartPermissionId).QueryRows(&items)
- return
- }
- type IndustrialToArticleCategoryRep struct {
- CategoryId int `description:"分类ID"`
- MatchTypeName string `description:"匹配类型"`
- IsRed bool `description:"是否标红"`
- }
- type IndustrialToArticleCategoryListRep struct {
- LayoutTime string `description:"布局时间"`
- IndustryName string `description:"产业名称"`
- IndustrialManagementId int `description:"产业D"`
- List []*IndustrialToArticleCategoryRep
- }
|