package models import ( "github.com/beego/beego/v2/client/orm" ) type CygxZhouqiArticleMap struct { CategoryId int `description:"产业Id"` MatchTypeName string `description:"行业名称"` SeriesName string `description:"系列名称"` ArticleUpdateTime string `description:"对应文章的更新时间"` } type CygxZhouqiArticleDetail struct { FiccReportId string `description:"Ficc研报单一篇报告,多个地方展示配置项"` } // 获取周期下面的一级分类 func GetCygxZhouqiArticleMapFirst() (items []*CygxZhouqiArticleMap, err error) { o := orm.NewOrm() sql := `SELECT category_id, match_type_name, series_name, article_update_time FROM cygx_zhouqi_article_map WHERE hidden = 0 AND parent_id = 0 ORDER BY sort DESC ` _, err = o.Raw(sql).QueryRows(&items) return } // 根据父级分类ID获取下面的子分类 func GetCygxZhouqiArticleMapByParentId(parentId int) (items []*CygxZhouqiArticleMap, err error) { o := orm.NewOrm() sql := `SELECT category_id, match_type_name, series_name, article_update_time FROM cygx_zhouqi_article_map WHERE parent_id = ? ` _, err = o.Raw(sql, parentId).QueryRows(&items) return } // 通过纪要ID获取详情 func GetCygxZhouqiArticleMapInfoById(categoryId int) (item *CygxZhouqiArticleDetail, err error) { o := orm.NewOrm() sql := `SELECT * FROM cygx_zhouqi_article_map WHERE category_id=? ` err = o.Raw(sql, categoryId).QueryRow(&item) return }