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;