package cygx import ( "github.com/beego/beego/v2/client/orm" "time" ) 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:"更新时间"` } type CygxReportMappingCelueResp 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:"更新时间"` } // 获取category_id 最大的值,进行累加 func GetCygxReportMappingCelueMaxDetail() (item *CygxReportMappingCelue, err error) { o := orm.NewOrmUsingDB("hz_cygx") sql := `SELECT * FROM cygx_report_mapping_celue ORDER BY category_id DESC LIMIT 1 ` err = o.Raw(sql).QueryRow(&item) return } // 通过 categoryId 获取详情 func GetCygxReportMappingCelueMaxDetailByCategoryId(categoryId int) (item *CygxReportMappingCelue, err error) { o := orm.NewOrmUsingDB("hz_cygx") sql := `SELECT * FROM cygx_report_mapping_celue WHERE category_id = ? LIMIT 1 ` err = o.Raw(sql, categoryId).QueryRow(&item) return } // 列表 func GetCygxReportMappingList(condition string, pars []interface{}) (items []*CygxReportMappingCelueResp, err error) { o := orm.NewOrmUsingDB("hz_cygx") sql := `SELECT * FROM cygx_report_mapping WHERE 1= 1 ` if condition != "" { sql += condition } _, err = o.Raw(sql, pars).QueryRows(&items) return } // 列表 func GetCygxReportMappingCelueList(condition string, pars []interface{}) (items []*CygxReportMappingCelueResp, err error) { o := orm.NewOrmUsingDB("hz_cygx") sql := `SELECT * FROM cygx_report_mapping_celue WHERE 1= 1 ` if condition != "" { sql += condition } _, err = o.Raw(sql, pars).QueryRows(&items) return }