article_category_mapping.go 2.4 KB

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