zhouqi_article_map.go 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. )
  5. type CygxZhouqiArticleMap struct {
  6. CategoryId int `description:"产业Id"`
  7. MatchTypeName string `description:"行业名称"`
  8. SeriesName string `description:"系列名称"`
  9. ArticleUpdateTime string `description:"对应文章的更新时间"`
  10. }
  11. type CygxZhouqiArticleDetail struct {
  12. FiccReportId string `description:"Ficc研报单一篇报告,多个地方展示配置项"`
  13. }
  14. // 获取周期下面的一级分类
  15. func GetCygxZhouqiArticleMapFirst() (items []*CygxZhouqiArticleMap, err error) {
  16. o := orm.NewOrm()
  17. sql := `SELECT
  18. category_id,
  19. match_type_name,
  20. series_name,
  21. article_update_time
  22. FROM
  23. cygx_zhouqi_article_map
  24. WHERE
  25. hidden = 0
  26. AND parent_id = 0
  27. ORDER BY
  28. sort DESC `
  29. _, err = o.Raw(sql).QueryRows(&items)
  30. return
  31. }
  32. // 根据父级分类ID获取下面的子分类
  33. func GetCygxZhouqiArticleMapByParentId(parentId int) (items []*CygxZhouqiArticleMap, err error) {
  34. o := orm.NewOrm()
  35. sql := `SELECT
  36. category_id,
  37. match_type_name,
  38. series_name,
  39. article_update_time
  40. FROM
  41. cygx_zhouqi_article_map
  42. WHERE
  43. parent_id = ? `
  44. _, err = o.Raw(sql, parentId).QueryRows(&items)
  45. return
  46. }
  47. // 通过纪要ID获取详情
  48. func GetCygxZhouqiArticleMapInfoById(categoryId int) (item *CygxZhouqiArticleDetail, err error) {
  49. o := orm.NewOrm()
  50. sql := `SELECT * FROM cygx_zhouqi_article_map WHERE category_id=? `
  51. err = o.Raw(sql, categoryId).QueryRow(&item)
  52. return
  53. }