report_mapping_celue.go 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. package cygx
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type CygxReportMappingCelue 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. SubCategoryName string `description:"主题"`
  12. ReportType int `description:"报告类型,2产业报告,1行业报告"`
  13. Sort int `description:"排序"`
  14. IsCustom int `description:"是否属于自定义的匹配类型 ,1是,0否"`
  15. IsSummary int `description:"是否是纪要库,1是,0否"`
  16. IsReport int `description:"是否是报告,1是,0否"`
  17. PermissionType int `description:"1主观,2客观"`
  18. CreateTime time.Time `description:"创建时间"`
  19. ModifyTime time.Time `description:"更新时间"`
  20. }
  21. type CygxReportMappingCelueResp struct {
  22. Id int `orm:"column(id);pk" description:"id"`
  23. ChartPermissionId int `description:"行业ID"`
  24. CategoryId int `description:"分类ID"`
  25. ChartPermissionName string `description:"行业名称"`
  26. SubCategoryName string `description:"主题"`
  27. ReportType int `description:"报告类型,2产业报告,1行业报告"`
  28. Sort int `description:"排序"`
  29. IsCustom int `description:"是否属于自定义的匹配类型 ,1是,0否"`
  30. IsSummary int `description:"是否是纪要库,1是,0否"`
  31. IsReport int `description:"是否是报告,1是,0否"`
  32. PermissionType int `description:"1主观,2客观"`
  33. CreateTime time.Time `description:"创建时间"`
  34. ModifyTime time.Time `description:"更新时间"`
  35. }
  36. // 获取category_id 最大的值,进行累加
  37. func GetCygxReportMappingCelueMaxDetail() (item *CygxReportMappingCelue, err error) {
  38. o := orm.NewOrmUsingDB("hz_cygx")
  39. sql := `SELECT * FROM cygx_report_mapping_celue ORDER BY category_id DESC LIMIT 1 `
  40. err = o.Raw(sql).QueryRow(&item)
  41. return
  42. }
  43. // 通过 categoryId 获取详情
  44. func GetCygxReportMappingCelueMaxDetailByCategoryId(categoryId int) (item *CygxReportMappingCelue, err error) {
  45. o := orm.NewOrmUsingDB("hz_cygx")
  46. sql := `SELECT * FROM cygx_report_mapping_celue WHERE category_id = ? LIMIT 1 `
  47. err = o.Raw(sql, categoryId).QueryRow(&item)
  48. return
  49. }
  50. // 列表
  51. func GetCygxReportMappingList(condition string, pars []interface{}) (items []*CygxReportMappingCelueResp, err error) {
  52. o := orm.NewOrmUsingDB("hz_cygx")
  53. sql := `SELECT * FROM cygx_report_mapping WHERE 1= 1 `
  54. if condition != "" {
  55. sql += condition
  56. }
  57. _, err = o.Raw(sql, pars).QueryRows(&items)
  58. return
  59. }
  60. // 列表
  61. func GetCygxReportMappingCelueList(condition string, pars []interface{}) (items []*CygxReportMappingCelueResp, err error) {
  62. o := orm.NewOrmUsingDB("hz_cygx")
  63. sql := `SELECT * FROM cygx_report_mapping_celue WHERE 1= 1 `
  64. if condition != "" {
  65. sql += condition
  66. }
  67. _, err = o.Raw(sql, pars).QueryRows(&items)
  68. return
  69. }