hsun 2 жил өмнө
parent
commit
c5555ef0a9

+ 12 - 0
models/tables/rddp/classify/query.go

@@ -93,6 +93,18 @@ func GetOtherIdsByClassifyNames(names []string) (ids []int, err error) {
 	return
 }
 
+// GetOtherIdsByClassifyNames 查询
+func GetOtherSecondIds(names []string) (ids []int, err error) {
+	var list []*Classify
+	err = global.MYSQL["rddp"].Model(Classify{}).Select("id").Where("parent_id IN (SELECT id FROM classify WHERE classify_name IN (?) AND parent_id = 0 AND is_show = 1)", names).Scan(&list).Error
+	if err != nil {
+		return
+	}
+	for _, v := range list {
+		ids = append(ids, v.Id)
+	}
+	return
+}
 
 // GetChildByPid 根据一级分类查找二级分类
 func GetChildByPid(pid int) (list []*Classify, err error) {

+ 2 - 1
services/report/report.go

@@ -281,7 +281,7 @@ func GetPurchaseDetail(permissionIds []int, userId uint64, classifyIdFirst int,
 			}
 			//获取所有二级分类的id
 			if classifyNameFirst == "大事点评" || classifyNameFirst == "会议纪要" || classifyNameFirst == "年报合集" {
-				classifyIdSeconds, tErr = classify.GetOtherIdsByClassifyNames(classifyNameSeconds)
+				classifyIdSeconds, tErr = classify.GetOtherSecondIds([]string{"大事点评", "会议纪要", "年报合集"})
 			} else {
 				classifyIdSeconds, tErr = classify.GetIdsByClassifyNameAndParentId(classifyNameSeconds, classifyIdFirst)
 			}
@@ -306,6 +306,7 @@ func GetPurchaseDetail(permissionIds []int, userId uint64, classifyIdFirst int,
 			}
 		}
 	}
+
 	var list []*purchase.Detail
 	ret = new(purchase.DetailResp)
 	if len(reports) > 0 {