Compare commits

..

No commits in common. "702ccbc7685a7222a06001f4267341b995f299ba" and "cd8d6a1adb2128481075f9a847c181e300b5b965" have entirely different histories.

View File

@ -93,7 +93,13 @@ public class BusiCategoryServiceImpl extends ServiceImpl<BusiCategoryMapper, Bus
if (categoryList == null || categoryList.isEmpty()) { if (categoryList == null || categoryList.isEmpty()) {
return categoryList; return categoryList;
} }
// 构建id到节点的映射便于查找
Map<String, BusiCategory> idToCategory = new HashMap<>();
for (BusiCategory category : categoryList) {
idToCategory.put(category.getId(), category);
}
// 构建树结构找出根节点
// 找到所有根节点parentId为null // 找到所有根节点parentId为null
List<BusiCategory> roots = new ArrayList<>(); List<BusiCategory> roots = new ArrayList<>();
for (BusiCategory category : categoryList) { for (BusiCategory category : categoryList) {