From 7cafada98b242615eaf99bd568e1cf0f888d9318 Mon Sep 17 00:00:00 2001 From: sxu <602087911@qq.com> Date: Mon, 28 Oct 2024 16:59:27 +0800 Subject: [PATCH] =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E6=A0=91=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ma/service/impl/TypeServiceImpl.java | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeServiceImpl.java b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeServiceImpl.java index f2979499..d1aa2562 100644 --- a/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeServiceImpl.java +++ b/bonus-modules/bonus-material/src/main/java/com/bonus/material/ma/service/impl/TypeServiceImpl.java @@ -347,20 +347,6 @@ public class TypeServiceImpl implements ITypeService { maTypeMap.put(treeSelect.getId(), treeSelect); } - // 3.遍历所有配置关联 -// for (WhHouseSet whHouseSet : whHouseSets) { -// // --- 数据校验 ---- -// if (whHouseSet == null || whHouseSet.getTypeId() == null) { continue; } -// // 构造函数定义0级Tree对象 -// TreeSelect thisTree = new TreeSelect(whHouseSet.getHouseId(),whHouseSet.getHouseName(),0,null); -// // 从Map中直接获取对应的1级节点 -// TreeSelect oneLevelTree = maTypeMap.get(whHouseSet.getTypeId()); -// // 转换为集合存入0级Tree对象中 -// thisTree.setChildren(oneLevelTree != null ? Collections.singletonList(oneLevelTree) : null); -// // 最后把0级Tree对象存入Result结果集合,返回给前端 -// treeSelectResultList.add(thisTree); -// } - // 3.遍历所有配置关联 Map> groupedById = whHouseSets.stream().collect(Collectors.groupingBy(WhHouseSet::getHouseId)); groupedById.forEach((id, itemList) -> { @@ -369,7 +355,9 @@ public class TypeServiceImpl implements ITypeService { for (WhHouseSet whHouseSet : itemList) { if (whHouseSet == null || whHouseSet.getTypeId() == null) { continue; } TreeSelect oneLevelTree = maTypeMap.get(whHouseSet.getTypeId()); - children.add(oneLevelTree != null ? oneLevelTree : null); + if (oneLevelTree != null) { + children.add(oneLevelTree); + } } thisTree.setChildren(children); treeSelectResultList.add(thisTree);