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:"对应文章的更新时间"` } // 获取周期下面的一级分类 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 }