tactics_time_line.go 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. Paging *paging.PagingItem `description:"分页数据"`
  30. List []*CygxTacticsTimeLineResp
  31. }
  32. type CygxTacticsTimeLineResp struct {
  33. TimeLineId int `description:"ID"`
  34. PublishTime string `description:"发布日期"`
  35. Status int `description:"0:未发布,1:已发布"`
  36. Content string `description:"内容"`
  37. ArticleId int `description:"文章ID"`
  38. ChartId int `description:"图表ID"`
  39. Link string `description:"文章或图表链接"`
  40. ChartPermissionName string `description:"行业名称"`
  41. }
  42. // 获取数量
  43. func GetCygxTacticsTimeLineCount(condition string, pars []interface{}) (count int, err error) {
  44. sqlCount := ` SELECT COUNT(1) AS count FROM cygx_tactics_time_line as art WHERE 1= 1 `
  45. if condition != "" {
  46. sqlCount += condition
  47. }
  48. o := orm.NewOrm()
  49. err = o.Raw(sqlCount, pars).QueryRow(&count)
  50. return
  51. }
  52. // 列表
  53. func GetCygxTacticsTimeLineList(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxTacticsTimeLineResp, err error) {
  54. o := orm.NewOrm()
  55. sql := `SELECT * FROM cygx_tactics_time_line as art WHERE 1= 1 `
  56. if condition != "" {
  57. sql += condition
  58. }
  59. sql += ` LIMIT ?,? `
  60. _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
  61. return
  62. }
  63. type GetCygxTacticsTimeLineDetailResp struct {
  64. Detail *CygxTacticsTimeLineResp
  65. }
  66. // 通过ID获取详情
  67. func GetCygxTacticsTimeLineDetail(timeLineId int) (item *CygxTacticsTimeLineResp, err error) {
  68. o := orm.NewOrm()
  69. sql := `SELECT * FROM cygx_tactics_time_line WHERE time_line_id=? `
  70. err = o.Raw(sql, timeLineId).QueryRow(&item)
  71. return
  72. }