research_report.go 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "hongze/hz_crm_api/utils"
  5. "time"
  6. )
  7. // ResearchReport 研究报告表(晨报、周报等)结构体
  8. type ResearchReport struct {
  9. ResearchReportId int `orm:"column(research_report_id);pk" description:"研究报告id"`
  10. ResearchReportName string `description:"研究报告名称"`
  11. ResearchReportTitle string `description:"研究报告标题"`
  12. ResearchReportImg string `description:"报告缩略图URL"`
  13. ResearchReportDate time.Time `description:"报告日期"`
  14. Type string `description:"报告类型,枚举值:day 晨报 week 周报 twoweek双周报 month 月报;默认:day"`
  15. Author string `description:"作者"`
  16. ReportVariety string `description:"研究报告的品种,双周报和月报有标识"`
  17. IsHasMenu int8 `description:"报告是否含有目录"`
  18. IsSendedMsg int8 `description:"是否发送过模板消息"`
  19. Periods int `description:"期数"`
  20. Status string `description:"状态,draft:草稿,"`
  21. Enabled int8 `description:"报告状态"`
  22. CreatedTime string `description:"创建时间"`
  23. LastUpdatedTime time.Time `description:"最近一次更新时间"`
  24. Viewers int `description:"H5观看用户数"`
  25. }
  26. // GetResearchReportListByIds 根据报告id集合获取报告数据列表
  27. func GetResearchReportListByIds(researchReportIds string) (list []*ResearchReport, err error) {
  28. if researchReportIds == "" {
  29. return
  30. }
  31. o := orm.NewOrm()
  32. sql := `select * from research_report where research_report_id in (` + researchReportIds + `)`
  33. _, err = o.Raw(sql).QueryRows(&list)
  34. return
  35. }
  36. // GetResearchReportListByIdList 根据报告id集合获取报告数据列表
  37. func GetResearchReportListByIdList(researchReportIdList []int) (list []*ResearchReport, err error) {
  38. num := len(researchReportIdList)
  39. if num <= 0 {
  40. return
  41. }
  42. o := orm.NewOrm()
  43. sql := `select * from research_report where research_report_id in (` + utils.GetOrmInReplace(num) + `)`
  44. _, err = o.Raw(sql, researchReportIdList).QueryRows(&list)
  45. return
  46. }
  47. // Update 更新数据
  48. func (researchReport *ResearchReport) Update(updateCols []string) (err error) {
  49. o := orm.NewOrm()
  50. _, err = o.Update(researchReport, updateCols...)
  51. return
  52. }
  53. type ResearchReportList struct {
  54. ResearchReportId int `orm:"column(research_report_id);pk" description:"研究报告id"`
  55. ResearchReportName string `description:"研究报告名称"`
  56. ResearchReportTitle string `description:"研究报告标题"`
  57. ResearchReportImg string `description:"报告缩略图URL"`
  58. ResearchReportDate time.Time `description:"报告日期"`
  59. Type string `description:"报告类型,枚举值:day 晨报 week 周报 twoweek双周报 month 月报;默认:day"`
  60. Author string `description:"作者"`
  61. ReportVariety string `description:"研究报告的品种,双周报和月报有标识"`
  62. IsHasMenu int8 `description:"报告是否含有目录"`
  63. IsSendedMsg int8 `description:"是否发送过模板消息"`
  64. Periods int `description:"期数"`
  65. Status string `description:"状态,draft:草稿,"`
  66. Enabled int8 `description:"报告状态"`
  67. CreatedTime string `description:"创建时间"`
  68. LastUpdatedTime time.Time `description:"最近一次更新时间"`
  69. Viewers int `description:"H5观看用户数"`
  70. LinkUrl string `description:"报告阅读地址"`
  71. }