Browse Source

no message

xingzai 2 years ago
parent
commit
129a3ef036
2 changed files with 10 additions and 4 deletions
  1. 7 1
      controllers/chart_permission.go
  2. 3 3
      models/report_mapping.go

+ 7 - 1
controllers/chart_permission.go

@@ -152,6 +152,7 @@ func (this *ChartPermissionAuthController) ReportDetail() {
 
 // @Title 获取策略下的所有分类
 // @Description 获取策略下的所有分类接口
+// @Param   ChartPermissionId   query   int  false     "行业id"
 // @Success 200 {object} models.ReportMappingResp
 // @router /strategyAll [get]
 func (this *ChartPermissionAuthController) StrategyDetail() {
@@ -166,8 +167,13 @@ func (this *ChartPermissionAuthController) StrategyDetail() {
 		br.Ret = 408
 		return
 	}
+	//默认给策略的ID
+	chartPermissionId, _ := this.GetInt("ChartPermissionId")
+	if chartPermissionId == 0 {
+		chartPermissionId = utils.CE_LUE_ID
+	}
 	uid := user.UserId
-	list, err := models.GetReportMappingStrategyHomeAll()
+	list, err := models.GetReportMappingStrategyHomeAll(chartPermissionId)
 
 	if err != nil {
 		br.Msg = "获取信息失败"

+ 3 - 3
models/report_mapping.go

@@ -56,7 +56,7 @@ func GetReportMappingStrategyAll() (items []*ReportMapping, err error) {
 }
 
 // 获取策略下面的所有分类
-func GetReportMappingStrategyHomeAll() (items []*ReportMappingHome, err error) {
+func GetReportMappingStrategyHomeAll(chartPermissionId int) (items []*ReportMappingHome, err error) {
 	o := orm.NewOrm()
 	sql := `SELECT
 	re.category_id,re.sub_category_name,re.match_type_name
@@ -65,12 +65,12 @@ FROM
 	INNER JOIN cygx_article AS art ON art.category_id = re.category_id 
 WHERE
 	re.report_type = 1 
-	AND re.chart_permission_id = 23 
+	AND re.chart_permission_id = ? 
 GROUP  BY
 	re.match_type_name
 ORDER BY
 	sort DESC , art.publish_date DESC`
-	_, err = o.Raw(sql).QueryRows(&items)
+	_, err = o.Raw(sql, chartPermissionId).QueryRows(&items)
 	return
 }