tactics_time_line.go 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "github.com/rdlucklib/rdluck_tools/paging"
  5. "time"
  6. )
  7. type CygxTacticsTimeLine struct {
  8. TimeLineId int `orm:"column(time_line_id);pk"`
  9. PublishTime time.Time `description:"发布日期"`
  10. CreateTime time.Time `description:"创建时间"`
  11. ModifyTime time.Time `description:"更新时间"`
  12. Status int `description:"0:未发布,1:已发布"`
  13. Content string `description:"内容"`
  14. ArticleId int `description:"文章ID"`
  15. ChartId int `description:"图表ID"`
  16. Link string `description:"文章或图表链接"`
  17. AdminId int `description:"管理员ID"`
  18. }
  19. type AddTacticsTimeLineReq struct {
  20. TimeLineId int `orm:"column(time_line_id);pk"`
  21. PublishTime string `description:"发布日期"`
  22. Content string `description:"内容"`
  23. Link string `description:"文章或图表链接"`
  24. }
  25. type TacticsTimeLineTimeLineIdReq struct {
  26. TimeLineId int `description:"ID"`
  27. }
  28. type GetCygxTacticsTimeLineResp struct {
  29. Status int `description:"0:内部可见,1:全部可见"`
  30. Paging *paging.PagingItem `description:"分页数据"`
  31. List []*CygxTacticsTimeLineResp
  32. }
  33. type CygxTacticsTimeLineResp struct {
  34. TimeLineId int `description:"ID"`
  35. PublishTime string `description:"发布日期"`
  36. Status int `description:"0:未发布,1:已发布"`
  37. Content string `description:"内容"`
  38. ArticleId int `description:"文章ID"`
  39. ChartId int `description:"图表ID"`
  40. Link string `description:"文章或图表链接"`
  41. Resource int `description:"来源类型,1:文章、2:产品内测、3:晨报点评"`
  42. }
  43. // 获取数量
  44. func GetCygxTacticsTimeLineCount(condition string, pars []interface{}) (count int, err error) {
  45. sqlCount := ` SELECT COUNT(1) AS count FROM cygx_tactics_time_line as art WHERE 1= 1 `
  46. if condition != "" {
  47. sqlCount += condition
  48. }
  49. o := orm.NewOrm()
  50. err = o.Raw(sqlCount, pars).QueryRow(&count)
  51. return
  52. }
  53. // 列表
  54. func GetCygxTacticsTimeLineList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxTacticsTimeLineResp, err error) {
  55. o := orm.NewOrm()
  56. sql := `SELECT * FROM cygx_tactics_time_line as art WHERE 1= 1 `
  57. if condition != "" {
  58. sql += condition
  59. }
  60. sql += ` LIMIT ?,? `
  61. _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
  62. return
  63. }
  64. type GetCygxTacticsTimeLineDetailResp struct {
  65. Detail *CygxTacticsTimeLineResp
  66. }
  67. // 通过ID获取详情
  68. func GetCygxTacticsTimeLineDetail(timeLineId int) (item *CygxTacticsTimeLineResp, err error) {
  69. o := orm.NewOrm()
  70. sql := `SELECT * FROM cygx_tactics_time_line WHERE time_line_id=? `
  71. err = o.Raw(sql, timeLineId).QueryRow(&item)
  72. return
  73. }