zqbao 9 сар өмнө
parent
commit
43a7a65525
1 өөрчлөгдсөн 14 нэмэгдсэн , 0 устгасан
  1. 14 0
      controllers/report.go

+ 14 - 0
controllers/report.go

@@ -72,6 +72,11 @@ func (this *ReportController) List() {
 			br.ErrMsg = "获取数据失败,Err:" + err.Error()
 			return
 		}
+		if len(classifyIds) == 0 {
+			br.Msg = "该品种下没有绑定分类"
+			br.ErrMsg = "获取数据失败,品种id:" + strconv.Itoa(chartPermissionId)
+			return
+		}
 		tmptotal, err := models.GetReportCountByClassifyIds(classifyIds, condition)
 		if err != nil {
 			br.Msg = "获取数据失败"
@@ -93,12 +98,21 @@ func (this *ReportController) List() {
 			br.ErrMsg = "获取数据失败,Err:" + err.Error()
 			return
 		}
+		if len(chartPermissionIds) == 0 {
+			br.Msg = "该品种下没有绑定分类"
+			br.ErrMsg = "获取数据失败,品种id:" + strconv.Itoa(chartPermissionId)
+			return
+		}
 		classifyIds, err := models.GetClassifyIdsListByIds(chartPermissionIds)
 		if err != nil {
 			br.Msg = "获取报告列表失败"
 			br.ErrMsg = "获取报告列表失败,Err:" + err.Error()
 			return
 		}
+		if len(classifyIds) == 0 {
+			br.Msg = "该品种下没有绑定分类"
+			return
+		}
 		tmptotal, err := models.GetReportCountByClassifyIds(classifyIds, condition)
 		if err != nil {
 			br.Msg = "获取数据失败"