123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 |
- package models
- import (
- "github.com/beego/beego/v2/client/orm"
- "time"
- //"time"
- )
- type CygxArticleCategoryMapping struct {
- Id int `orm:"column(id);pk" description:"id"`
- ChartPermissionId int `description:"行业ID"`
- CategoryId int `description:"分类ID"`
- ChartPermissionName string `description:"行业名称"`
- MatchTypeName string `description:"分类名称"`
- ReportType int `description:"报告类型,2产业报告,1行业报告"`
- SubCategoryName string `description:"主题"`
- Sort int `description:"排序"`
- IsCustom int `description:"是否属于自定义的匹配类型 ,1是,0否"`
- IsSummary int `description:"是否是纪要库,1是,0否"`
- IsReport int `description:"是否是报告,1是,0否"`
- PermissionType int `description:"1主观,2客观"`
- CygxId int `description:"分类聚合ID"`
- CeLueId int `description:"策略平台领域ID"`
- }
- // 添加
- func AddCygxArticleCategoryMapping(item *CygxArticleCategoryMapping) (lastId int64, err error) {
- o := orm.NewOrm()
- lastId, err = o.Insert(item)
- return
- }
- // 添加
- func AddCygxReportMappingCygx(item *CygxReportMappingCygx) (lastId int64, err error) {
- o := orm.NewOrm()
- lastId, err = o.Insert(item)
- return
- }
- // 获取数量
- func GetCygxReportMappingCygxCount(condition string) (count int, err error) {
- sqlCount := ` SELECT COUNT(1) AS count FROM cygx_report_mapping_cygx as art WHERE 1= 1 `
- if condition != "" {
- sqlCount += condition
- }
- o := orm.NewOrm()
- err = o.Raw(sqlCount).QueryRow(&count)
- return
- }
- // 获取所有的报告分类 查研观向
- func GetCygxReportMappingCygx() (items []*CygxReportMappingCygx, err error) {
- o := orm.NewOrm()
- sql := `SELECT
- *
- FROM
- cygx_report_mapping_cygx `
- _, err = o.Raw(sql).QueryRows(&items)
- return
- }
- // 获取所有的报告分类 策略
- func GetCygxReportMappingcelue(condition string) (items []*CygxReportMapping, err error) {
- o := orm.NewOrm()
- sql := `SELECT
- *
- FROM
- cygx_report_mapping_celue WHERE 1= 1 `
- if condition != "" {
- sql += condition
- }
- _, err = o.Raw(sql).QueryRows(&items)
- return
- }
- // 通过分类ID获取详情
- func GetCygxReportMappingCygxByCategoryId(categoryId int) (item *CygxReportMappingCygx, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM cygx_report_mapping_cygx WHERE id=? `
- err = o.Raw(sql, categoryId).QueryRow(&item)
- return
- }
- type CygxReportMappingCelue struct {
- Id int `orm:"column(id);pk" description:"id"`
- ChartPermissionId int `description:"行业ID"`
- CategoryId int `description:"分类ID"`
- ChartPermissionName string `description:"行业名称"`
- SubCategoryName string `description:"主题"`
- ReportType int `description:"报告类型,2产业报告,1行业报告"`
- Sort int `description:"排序"`
- IsCustom int `description:"是否属于自定义的匹配类型 ,1是,0否"`
- IsSummary int `description:"是否是纪要库,1是,0否"`
- IsReport int `description:"是否是报告,1是,0否"`
- PermissionType int `description:"1主观,2客观"`
- CreateTime time.Time `description:"创建时间"`
- ModifyTime time.Time `description:"更新时间"`
- }
- // 通过 categoryId 获取详情
- func GetCygxReportMappingCelueMaxDetailByCategoryId(categoryId int) (item *CygxReportMappingCelue, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM cygx_report_mapping_celue WHERE category_id = ? LIMIT 1 `
- err = o.Raw(sql, categoryId).QueryRow(&item)
- return
- }
|