article_category_mapping.go 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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 CygxReportMappingGroup struct {
  30. Id int `orm:"column(id);pk" description:"id"`
  31. IdCygx int `description:"分类ID"`
  32. CategoryIdCelue int `description:"分类ID"`
  33. CreateTime time.Time `description:"创建时间"`
  34. ModifyTime time.Time `description:"更新时间"`
  35. }
  36. // 添加
  37. func AddCygxReportMappingGroup(item *CygxReportMappingGroup) (lastId int64, err error) {
  38. o := orm.NewOrm()
  39. lastId, err = o.Insert(item)
  40. return
  41. }
  42. // 添加
  43. func AddCygxReportMappingCygx(item *CygxReportMappingCygx) (lastId int64, err error) {
  44. o := orm.NewOrm()
  45. lastId, err = o.Insert(item)
  46. return
  47. }
  48. // 获取数量
  49. func GetCygxReportMappingCygxCount(condition string) (count int, err error) {
  50. sqlCount := ` SELECT COUNT(1) AS count FROM cygx_report_mapping_cygx as art WHERE 1= 1 `
  51. if condition != "" {
  52. sqlCount += condition
  53. }
  54. o := orm.NewOrm()
  55. err = o.Raw(sqlCount).QueryRow(&count)
  56. return
  57. }
  58. // 获取所有的报告分类 查研观向
  59. func GetCygxReportMappingCygx() (items []*CygxReportMappingCygx, err error) {
  60. o := orm.NewOrm()
  61. sql := `SELECT
  62. *
  63. FROM
  64. cygx_report_mapping_cygx `
  65. _, err = o.Raw(sql).QueryRows(&items)
  66. return
  67. }
  68. // 获取所有的报告分类 策略
  69. func GetCygxReportMappingcelue(condition string) (items []*CygxReportMapping, err error) {
  70. o := orm.NewOrm()
  71. sql := `SELECT
  72. *
  73. FROM
  74. cygx_report_mapping_celue WHERE 1= 1 `
  75. if condition != "" {
  76. sql += condition
  77. }
  78. _, err = o.Raw(sql).QueryRows(&items)
  79. return
  80. }
  81. // 通过分类ID获取详情
  82. func GetCygxReportMappingCygxByCategoryId(categoryId int) (item *CygxReportMappingCygx, err error) {
  83. o := orm.NewOrm()
  84. sql := `SELECT * FROM cygx_report_mapping_cygx WHERE id=? `
  85. err = o.Raw(sql, categoryId).QueryRow(&item)
  86. return
  87. }