Browse Source

no message

xingzai 1 year ago
parent
commit
6192ccab8a
2 changed files with 29 additions and 2 deletions
  1. 21 2
      controllers/cygx/report_article.go
  2. 8 0
      models/cygx/report_mapping_cygx.go

+ 21 - 2
controllers/cygx/report_article.go

@@ -196,8 +196,27 @@ func (this *ReportArticleController) ReportArticleList() {
 		condition += ` AND art.publish_date <= ` + "'" + endDate + " 23:59:59'"
 	}
 	//报告匹配类型
-	if matchTypeName != "" {
-		condition += ` AND re.match_type_name  =  ` + "'" + matchTypeName + "' "
+	if matchTypeName != "" && chartPermissionId > 0 {
+		//condition += ` AND re.match_type_name  =  ` + "'" + matchTypeName + "' "
+		mappingCygxDetai, err := cygx.GetCygxReportMappingCygxDetailByNameAndChartPermissionId(matchTypeName, chartPermissionId)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取失败,Err:" + err.Error()
+			return
+		}
+		if mappingCygxDetai == nil {
+			resp := new(cygx.GetReportArticleListRep)
+			resp.List = make([]*cygx.CygxReportArticle, 0)
+			page := paging.GetPaging(currentIndex, pageSize, 0)
+			resp.Paging = page
+			br.Ret = 200
+			br.Success = true
+			br.Msg = "获取成功"
+			br.Data = resp
+			return
+		}
+		//这里量不大,走一下子查询
+		condition += ` 	AND art.category_id IN ( SELECT category_id_celue FROM cygx_report_mapping_group WHERE id_cygx = ` + strconv.Itoa(mappingCygxDetai.Id) + ` )  `
 	}
 	// 报告标签
 	if reportLabel != "" {

+ 8 - 0
models/cygx/report_mapping_cygx.go

@@ -119,3 +119,11 @@ func GetCygxReportMappingCygxDetailByName(name string) (item *CygxReportMappingC
 	err = o.Raw(sql, name).QueryRow(&item)
 	return
 }
+
+// 通过ID获取详情
+func GetCygxReportMappingCygxDetailByNameAndChartPermissionId(name string, chartPermissionId int) (item *CygxReportMappingCygx, err error) {
+	o := orm.NewOrmUsingDB("hz_cygx")
+	sql := `SELECT * FROM cygx_report_mapping_cygx  WHERE match_type_name=?  AND chart_permission_id = ?  LIMIT 1 `
+	err = o.Raw(sql, name, chartPermissionId).QueryRow(&item)
+	return
+}