report_selection_log.go 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type CygxReportSelectionLog struct {
  7. ArticleSunId int `description:"子级报告id"`
  8. ArticleId int `description:"父级报告Id"`
  9. ChartPermissionId int `description:"行业ID"`
  10. PermissionName string `description:"行业ID"`
  11. CreateTime time.Time `description:"创建时间"`
  12. Body string `description:"内容"`
  13. IndustrialSubjectId int `description:"标的ID"`
  14. IndustrialManagementId string `description:"产业资源包Id 多个用 , 隔开"`
  15. SubjectName string `description:"标的名称"`
  16. IcoLink string `orm:"column(image_url)"description:"图标链接"`
  17. CompanyLabel []string `description:"公司标签"`
  18. Label string `description:"公司标签"`
  19. OverviewArticleId int `description:"综述报告Id"`
  20. }
  21. type CygxReportSelectionLogResp struct {
  22. ArticleSunId int `description:"子级报告id"`
  23. ArticleId int `description:"父级报告Id"`
  24. ChartPermissionId int `description:"行业ID"`
  25. PermissionName string `description:"行业ID"`
  26. CreateTime time.Time `description:"创建时间"`
  27. Body string `description:"内容"`
  28. IndustrialSubjectId int `description:"标的ID"`
  29. IndustrialManagementId string `description:"产业资源包Id 多个用 , 隔开"`
  30. SubjectName string `description:"标的名称"`
  31. IcoLink string `orm:"column(image_url)"description:"图标链接"`
  32. CompanyLabel []string `description:"公司标签"`
  33. Label string `description:"公司标签"`
  34. OverviewArticleId int `description:"综述报告Id"`
  35. }
  36. // 列表
  37. func GetCygxReportSelectionLog(condition string, pars []interface{}, startSize, pageSize int) (items []*CygxReportSelectionLog, err error) {
  38. o := orm.NewOrm()
  39. sql := `SELECT * FROM cygx_report_selection_log as art WHERE 1= 1 `
  40. if condition != "" {
  41. sql += condition
  42. }
  43. sql += ` LIMIT ?,? `
  44. _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
  45. return
  46. }
  47. // 通过ID获取详情
  48. func GetCygxReportSelectionLogDetail(articleId int, subjectName string) (item *CygxReportSelectionLogResp, err error) {
  49. o := orm.NewOrm()
  50. sql := `SELECT * FROM cygx_report_selection_log WHERE article_id=? AND subject_name = ? LIMIT 1 `
  51. err = o.Raw(sql, articleId, subjectName).QueryRow(&item)
  52. return
  53. }