article_category_mapping.go 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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. type CygxReportMappingCygx struct {
  30. Id int `orm:"column(id);pk" description:"id"`
  31. ChartPermissionId int `description:"行业ID"`
  32. ChartPermissionName string `description:"行业名称"`
  33. MatchTypeName string `description:"分类名称"`
  34. ReportType int `description:"报告类型,2产业报告,1行业报告"`
  35. Sort int `description:"排序"`
  36. IsCustom int `description:"是否属于自定义的匹配类型 ,1是,0否"`
  37. IsSummary int `description:"是否是纪要库,1是,0否"`
  38. IsReport int `description:"是否是报告,1是,0否"`
  39. PermissionType int `description:"1主观,2客观"`
  40. }
  41. type CygxReportMappingGroup struct {
  42. Id int `orm:"column(id);pk" description:"id"`
  43. IdCygx int `description:"分类ID"`
  44. CategoryIdCelue int `description:"分类ID"`
  45. CreateTime time.Time `description:"创建时间"`
  46. ModifyTime time.Time `description:"更新时间"`
  47. }
  48. // 添加
  49. func AddCygxReportMappingGroup(item *CygxReportMappingGroup) (lastId int64, err error) {
  50. o := orm.NewOrm()
  51. lastId, err = o.Insert(item)
  52. return
  53. }
  54. // 添加
  55. func AddCygxReportMappingCygx(item *CygxReportMappingCygx) (lastId int64, err error) {
  56. o := orm.NewOrm()
  57. lastId, err = o.Insert(item)
  58. return
  59. }
  60. // 获取数量
  61. func GetCygxReportMappingCygxCount(condition string) (count int, err error) {
  62. sqlCount := ` SELECT COUNT(1) AS count FROM cygx_report_mapping_cygx as art WHERE 1= 1 `
  63. if condition != "" {
  64. sqlCount += condition
  65. }
  66. o := orm.NewOrm()
  67. err = o.Raw(sqlCount).QueryRow(&count)
  68. return
  69. }
  70. // 获取所有的报告分类 查研观向
  71. func GetCygxReportMappingCygx() (items []*CygxReportMappingCygx, err error) {
  72. o := orm.NewOrm()
  73. sql := `SELECT
  74. *
  75. FROM
  76. cygx_report_mapping_cygx `
  77. _, err = o.Raw(sql).QueryRows(&items)
  78. return
  79. }
  80. // 通过分类ID获取详情
  81. func GetCygxReportMappingCygxByCategoryId(categoryId int) (item *CygxReportMappingCygx, err error) {
  82. o := orm.NewOrm()
  83. sql := `SELECT * FROM cygx_report_mapping_cygx WHERE id=? `
  84. err = o.Raw(sql, categoryId).QueryRow(&item)
  85. return
  86. }