123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- package models
- import "rdluck_tools/orm"
- type ReportMapping struct {
- CategoryId int `description:"分类ID"`
- SubCategoryName string `description:"权限名称"`
- IsRead bool `description:"是否标红"`
- }
- type TradeReportMapping struct {
- CategoryId int `description:"分类ID"`
- SubCategoryName string `description:"权限名称"`
- IsRead bool `description:"是否标红"`
- UpdateTime string `description:"更新时间"`
- }
- type ReportMappingResp struct {
- List []*ReportMapping
- }
- type TradeReportMappingResp struct {
- List []*TradeReportMapping
- }
- //获取策略下面的所有分类
- func GetReportMappingStrategyAll() (items []*ReportMapping, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM cygx_report_mapping WHERE report_type=1 AND chart_permission_id=23 ORDER BY sort ASC `
- _, err = o.Raw(sql).QueryRows(&items)
- return
- }
- //行业列表
- func GetTradeAll(ChartPermissionId int) (items []*TradeReportMapping, err error) {
- o := orm.NewOrm()
- sql := `SELECT * FROM cygx_report_mapping WHERE chart_permission_id = ? AND report_type = 1;`
- _, err = o.Raw(sql, ChartPermissionId).QueryRows(&items)
- return
- }
- type IndustrialToArticleCategoryRep struct {
- CategoryId int `description:"分类ID"`
- MatchTypeName string `description:"权限名称"`
- IsRead bool `description:"是否标红"`
- }
- type IndustrialToArticleCategoryListRep struct {
- LayoutTime string `description:"布局时间"`
- IndustryName string `description:"产业名称"`
- List []*IndustrialToArticleCategoryRep
- }
- //产业下所关联的文章分类列表
- func IndustrialToArticleCategory(industrialManagementId int) (items []*IndustrialToArticleCategoryRep, err error) {
- o := orm.NewOrm()
- sql := `SELECT map.match_type_name,map.category_id
- FROM cygx_report_mapping AS map
- INNER JOIN cygx_article AS art ON art.category_id = map.category_id
- INNER JOIN cygx_industrial_article_group_management AS man_g ON man_g.article_id = art.article_id
- WHERE map.report_type = 2
- AND man_g.industrial_management_id =?
- GROUP BY map.match_type_name`
- _, err = o.Raw(sql, industrialManagementId).QueryRows(&items)
- return
- }
|