This commit is contained in:
PQZ 2025-07-01 11:27:11 +08:00
parent 54525e6ce7
commit 09a5c7da55

View File

@ -93,13 +93,7 @@ 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) {