|
@@ -53,7 +53,7 @@ func DocumentClassifyList(userId int) ([]models.ClassifyVO, error) {
|
|
|
classifyVO.IsCollect = 1
|
|
|
}
|
|
|
|
|
|
- classifyVO.Children = getChildClassify(classifyList, classify.Id)
|
|
|
+ classifyVO.Children = getChildClassify(classifyList, classify.Id, collectClassifyMap)
|
|
|
classifyVOList = append(classifyVOList, classifyVO)
|
|
|
}
|
|
|
}
|
|
@@ -61,7 +61,7 @@ func DocumentClassifyList(userId int) ([]models.ClassifyVO, error) {
|
|
|
return classifyVOList, nil
|
|
|
}
|
|
|
|
|
|
-func getChildClassify(classifyList []models.Classify, classifyId int) *[]models.ClassifyVO {
|
|
|
+func getChildClassify(classifyList []models.Classify, classifyId int, collectClassifyMap map[int]bool) *[]models.ClassifyVO {
|
|
|
childList := make([]models.ClassifyVO, 0)
|
|
|
for _, classify := range classifyList {
|
|
|
if classify.ParentId == classifyId {
|
|
@@ -72,7 +72,10 @@ func getChildClassify(classifyList []models.Classify, classifyId int) *[]models.
|
|
|
Sort: classify.Sort,
|
|
|
Enabled: classify.Enabled,
|
|
|
}
|
|
|
- classifyVO.Children = getChildClassify(classifyList, classify.Id)
|
|
|
+ if _, ok := collectClassifyMap[classify.Id]; ok {
|
|
|
+ classifyVO.IsCollect = 1
|
|
|
+ }
|
|
|
+ classifyVO.Children = getChildClassify(classifyList, classify.Id, collectClassifyMap)
|
|
|
childList = append(childList, classifyVO)
|
|
|
}
|
|
|
}
|