类型树问题
This commit is contained in:
parent
01b38fd22e
commit
7cafada98b
|
|
@ -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<Long, List<WhHouseSet>> 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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue