day_new_default.go 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package day_new
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. )
  5. type DayNewDefault struct {
  6. Id int `orm:"column(id);pk" description:"序号"`
  7. ClassifyIdFirst int `description:"一级分类id"`
  8. ClassifyNameFirst string `description:"一级分类名称"`
  9. ClassifyIdSecond int `description:"二级分类id"`
  10. ClassifyNameSecond string `description:"二级分类名称"`
  11. ClassifyIdThird int `description:"三级分类ID"`
  12. ClassifyNameThird string `description:"三级分类名称"`
  13. Title string `description:"标题"`
  14. Abstract string `description:"摘要"`
  15. Author string `description:"作者"`
  16. Frequency string `description:"频度"`
  17. CreateTime string `description:"创建时间"`
  18. Overview string `description:"英文概述部分"`
  19. ModifyTime string `description:"修改时间"`
  20. }
  21. type EnglishReportDefaultSaveReq struct {
  22. ClassifyIdFirst int `description:"一级分类id"`
  23. ClassifyNameFirst string `description:"一级分类名称"`
  24. ClassifyIdSecond int `description:"二级分类id"`
  25. ClassifyNameSecond string `description:"二级分类名称"`
  26. ClassifyIdThird int `description:"三级分类ID"`
  27. ClassifyNameThird string `description:"三级分类名称"`
  28. Title string `description:"标题"`
  29. Abstract string `description:"摘要"`
  30. Author string `description:"作者"`
  31. Frequency string `description:"频度"`
  32. Overview string `description:"英文概述部分"`
  33. }
  34. // 获取每日资讯的默认配置
  35. func GetDayNewDefault() (item *DayNewDefault, err error) {
  36. o := orm.NewOrm()
  37. sql := `select * from day_new_default order by id desc limit 1`
  38. err = o.Raw(sql).QueryRow(&item)
  39. return
  40. }
  41. // AddDayNewDefault 新增默认值
  42. func AddDayNewDefault(item *DayNewDefault) (err error) {
  43. o := orm.NewOrm()
  44. _, err = o.Insert(item)
  45. return
  46. }
  47. // Update 更新
  48. func (item *DayNewDefault) Update(cols []string) (err error) {
  49. o := orm.NewOrm()
  50. _, err = o.Update(item, cols...)
  51. return
  52. }