article_category_mapping.go 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. //"time"
  6. )
  7. type CygxArticleCategoryMapping struct {
  8. Id int `orm:"column(id);pk" description:"id"`
  9. ChartPermissionId int `description:"行业ID"`
  10. CategoryId int `description:"分类ID"`
  11. ChartPermissionName string `description:"行业名称"`
  12. MatchTypeName string `description:"分类名称"`
  13. ReportType int `description:"报告类型,2产业报告,1行业报告"`
  14. SubCategoryName string `description:"主题"`
  15. Sort int `description:"排序"`
  16. IsCustom int `description:"是否属于自定义的匹配类型 ,1是,0否"`
  17. IsSummary int `description:"是否是纪要库,1是,0否"`
  18. IsReport int `description:"是否是报告,1是,0否"`
  19. PermissionType int `description:"1主观,2客观"`
  20. CygxId int `description:"分类聚合ID"`
  21. CeLueId int `description:"策略平台领域ID"`
  22. }
  23. // 添加
  24. func AddCygxArticleCategoryMapping(item *CygxArticleCategoryMapping) (lastId int64, err error) {
  25. o := orm.NewOrm()
  26. lastId, err = o.Insert(item)
  27. return
  28. }
  29. // 添加
  30. func AddCygxReportMappingCygx(item *CygxReportMappingCygx) (lastId int64, err error) {
  31. o := orm.NewOrm()
  32. lastId, err = o.Insert(item)
  33. return
  34. }
  35. // 获取数量
  36. func GetCygxReportMappingCygxCount(condition string) (count int, err error) {
  37. sqlCount := ` SELECT COUNT(1) AS count FROM cygx_report_mapping_cygx as art WHERE 1= 1 `
  38. if condition != "" {
  39. sqlCount += condition
  40. }
  41. o := orm.NewOrm()
  42. err = o.Raw(sqlCount).QueryRow(&count)
  43. return
  44. }
  45. // 获取所有的报告分类 查研观向
  46. func GetCygxReportMappingCygx() (items []*CygxReportMappingCygx, err error) {
  47. o := orm.NewOrm()
  48. sql := `SELECT
  49. *
  50. FROM
  51. cygx_report_mapping_cygx `
  52. _, err = o.Raw(sql).QueryRows(&items)
  53. return
  54. }
  55. // 获取所有的报告分类 策略
  56. func GetCygxReportMappingcelue(condition string) (items []*CygxReportMapping, err error) {
  57. o := orm.NewOrm()
  58. sql := `SELECT
  59. *
  60. FROM
  61. cygx_report_mapping_celue WHERE 1= 1 `
  62. if condition != "" {
  63. sql += condition
  64. }
  65. _, err = o.Raw(sql).QueryRows(&items)
  66. return
  67. }
  68. // 通过分类ID获取详情
  69. func GetCygxReportMappingCygxByCategoryId(categoryId int) (item *CygxReportMappingCygx, err error) {
  70. o := orm.NewOrm()
  71. sql := `SELECT * FROM cygx_report_mapping_cygx WHERE id=? `
  72. err = o.Raw(sql, categoryId).QueryRow(&item)
  73. return
  74. }
  75. type CygxReportMappingCelue struct {
  76. Id int `orm:"column(id);pk" description:"id"`
  77. ChartPermissionId int `description:"行业ID"`
  78. CategoryId int `description:"分类ID"`
  79. ChartPermissionName string `description:"行业名称"`
  80. SubCategoryName string `description:"主题"`
  81. ReportType int `description:"报告类型,2产业报告,1行业报告"`
  82. Sort int `description:"排序"`
  83. IsCustom int `description:"是否属于自定义的匹配类型 ,1是,0否"`
  84. IsSummary int `description:"是否是纪要库,1是,0否"`
  85. IsReport int `description:"是否是报告,1是,0否"`
  86. PermissionType int `description:"1主观,2客观"`
  87. CreateTime time.Time `description:"创建时间"`
  88. ModifyTime time.Time `description:"更新时间"`
  89. }
  90. // 通过 categoryId 获取详情
  91. func GetCygxReportMappingCelueMaxDetailByCategoryId(categoryId int) (item *CygxReportMappingCelue, err error) {
  92. o := orm.NewOrm()
  93. sql := `SELECT * FROM cygx_report_mapping_celue WHERE category_id = ? LIMIT 1 `
  94. err = o.Raw(sql, categoryId).QueryRow(&item)
  95. return
  96. }