tactics.go 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. package models
  2. import (
  3. "rdluck_tools/orm"
  4. "time"
  5. )
  6. type Tactics struct {
  7. ArticleId int `description:"文章id"`
  8. Title string `description:"标题"`
  9. TitleEn string `description:"英文标题"`
  10. UpdateFrequency string `description:"更新周期"`
  11. PublishDate time.Time `description:"发布时间"`
  12. PublishStatus int `description:"发布状态"`
  13. Department string `description:"作者"`
  14. Body string `description:"内容"`
  15. Abstract string `description:"摘要"`
  16. Annotation string `description:"注解"`
  17. CategoryName string `description:"分类"`
  18. SubCategoryName string `description:"子级分类"`
  19. CategoryId int `description:"分类id"`
  20. CreateDate string `description:"创建日期"`
  21. }
  22. func GetTacticsList(endDate string) (list []*Tactics, err error) {
  23. o := orm.NewOrm()
  24. o.Using("tactics")
  25. sql := `SELECT a.*,b.body,b.abstract,b.annotation,b.article_id,d.category_name,d.sub_category_name,c.category_id
  26. FROM article_articleinfo AS a
  27. INNER JOIN article_content AS b ON a.id=b.article_id
  28. INNER JOIN article_category AS c ON a.id=c.article_id
  29. INNER JOIN article_categoryinfo AS d ON c.category_id=d.id
  30. WHERE a.publish_status=1 AND a.publish_date>=? AND d.id IN (28,32,45,50,57,62,72,74,79,84,86,88,90)
  31. AND a.id NOT IN (3454,3456,3457,3459,2449,2450,2453,2454,2459,2530,2583,2663,2670,2699,2715,2732,2748,2759,2399,2356,2870,3173,2978,2826,3470) `
  32. _, err = o.Raw(sql, endDate).QueryRows(&list)
  33. return
  34. }
  35. func GetTacticsListAll() (list []*Tactics, err error) {
  36. o := orm.NewOrm()
  37. o.Using("tactics")
  38. sql := `SELECT a.*,b.body,b.abstract,b.annotation,b.article_id,d.category_name,d.sub_category_name,c.category_id
  39. FROM article_articleinfo AS a
  40. INNER JOIN article_content AS b ON a.id=b.article_id
  41. INNER JOIN article_category AS c ON a.id=c.article_id
  42. INNER JOIN article_categoryinfo AS d ON c.category_id=d.id
  43. WHERE a.publish_status=1 AND d.id IN (28,32,45,50,57,62,72,74,79,84,86,88,90)
  44. AND a.id NOT IN (3454,3456,3457,3459,2449,2450,2453,2454,2459,2530,2583,2663,2670,2699,2715,2732,2748,2759,2399,2356,2870,3173,2978,2826,3470) `
  45. //IN(85,71)
  46. _, err = o.Raw(sql).QueryRows(&list)
  47. return
  48. }
  49. func GetCygxArticleListAll() (list []*Tactics, err error) {
  50. o := orm.NewOrm()
  51. sql := `SELECT * FROM cygx_article `
  52. _, err = o.Raw(sql).QueryRows(&list)
  53. return
  54. }