From cde0608e025c5a577a6584f1c93e3cf2ac8bd0b0 Mon Sep 17 00:00:00 2001 From: Chengliang <1546584672@qq.com> Date: Tue, 14 Jun 2022 18:00:51 +0800 Subject: [PATCH] =?UTF-8?q?=E8=87=AA=E5=AE=9A=E4=B9=89=E6=A0=91=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E4=BF=AE=E5=A5=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/extend/bo/ExtendGroupBO.java | 18 +++++++----------- .../entity/fieldset/vo/TypeTreeVO.java | 5 ++++- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/com/engine/organization/entity/extend/bo/ExtendGroupBO.java b/src/com/engine/organization/entity/extend/bo/ExtendGroupBO.java index b2976b53..cf4f9b6a 100644 --- a/src/com/engine/organization/entity/extend/bo/ExtendGroupBO.java +++ b/src/com/engine/organization/entity/extend/bo/ExtendGroupBO.java @@ -1,7 +1,10 @@ package com.engine.organization.entity.extend.bo; import com.engine.organization.entity.extend.po.ExtendGroupPO; +import com.engine.organization.entity.extend.po.ExtendTitlePO; import com.engine.organization.entity.fieldset.vo.TypeTreeVO; +import com.engine.organization.mapper.extend.ExtendTitleMapper; +import com.engine.organization.util.db.MapperProxyFactory; import org.apache.commons.collections.CollectionUtils; import java.util.Collections; @@ -29,7 +32,6 @@ public class ExtendGroupBO { .canClick(true) .domid(String.valueOf(e.getId())) .hasGroup(isHasGroup(e.getId())) - .haschild(getHasChild(e.getId())) .isShow(e.getIsShow()) .key(e.getId()) .name(e.getGroupName()) @@ -38,20 +40,14 @@ public class ExtendGroupBO { .build()).collect(Collectors.toList()); //获取非一级 - Map> collects = typeTreeVOS.stream().filter(item -> item.getPid() != null).collect(Collectors.groupingBy(TypeTreeVO ::getPid)); + Map> collects = typeTreeVOS.stream().filter(item -> item.getPid() != null).collect(Collectors.groupingBy(TypeTreeVO :: getPid)); - return typeTreeVOS.stream().peek(e -> e.setSubs(collects.get(e.getKey()))).filter(item -> item.getPid() == null).collect(Collectors.toList()); - - } - - - - private static boolean getHasChild(Long id) { - return true; + return typeTreeVOS.stream().peek(e -> {e.setChilds(collects.get(e.getKey())); e.setHaschild(collects.get(e.getKey()) != null && collects.get(e.getKey()).size() > 0);}).filter(item -> item.getPid() == null).collect(Collectors.toList()); } private static boolean isHasGroup(Long id) { - return true; + List titlesByGroupID = MapperProxyFactory.getProxy(ExtendTitleMapper.class).getTitlesByGroupID(id); + return titlesByGroupID.size() > 0; } } diff --git a/src/com/engine/organization/entity/fieldset/vo/TypeTreeVO.java b/src/com/engine/organization/entity/fieldset/vo/TypeTreeVO.java index 7f8cf125..32c09f11 100644 --- a/src/com/engine/organization/entity/fieldset/vo/TypeTreeVO.java +++ b/src/com/engine/organization/entity/fieldset/vo/TypeTreeVO.java @@ -5,6 +5,7 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import java.util.ArrayList; import java.util.List; /** @@ -58,11 +59,13 @@ public class TypeTreeVO { private String name; //子节点 - private List subs; + private List childs; // private int viewAttr; + private ArrayList subs; + //父节点id private Long pid;