自定义设置页面树
parent
c3d5c50783
commit
6b1ce95b48
@ -0,0 +1,57 @@
|
|||||||
|
package com.engine.organization.entity.extend.bo;
|
||||||
|
|
||||||
|
import com.engine.organization.entity.extend.po.ExtendGroupPO;
|
||||||
|
import com.engine.organization.entity.fieldset.vo.TypeTreeVO;
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author weaver_cl
|
||||||
|
* @Description:
|
||||||
|
* @Date 2022/6/14
|
||||||
|
* @Version V1.0
|
||||||
|
**/
|
||||||
|
public class ExtendGroupBO {
|
||||||
|
|
||||||
|
public static List<TypeTreeVO> buildTypeTree(List<ExtendGroupPO> extendGroupPOS) {
|
||||||
|
|
||||||
|
if(CollectionUtils.isEmpty(extendGroupPOS)){
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<TypeTreeVO> typeTreeVOS = extendGroupPOS.stream().map(e ->
|
||||||
|
TypeTreeVO.builder()
|
||||||
|
.addChild(e.getId() >= 0)
|
||||||
|
.canClick(true)
|
||||||
|
.domid(String.valueOf(e.getId()))
|
||||||
|
.hasGroup(isHasGroup(e.getId()))
|
||||||
|
.haschild(getHasChild(e.getId()))
|
||||||
|
.isShow(e.getIsShow())
|
||||||
|
.key(e.getId())
|
||||||
|
.name(e.getGroupName())
|
||||||
|
.viewAttr(e.getId() <= 0 ? 1 : 2)
|
||||||
|
.pid(e.getPid())
|
||||||
|
.build()).collect(Collectors.toList());
|
||||||
|
|
||||||
|
//获取非一级
|
||||||
|
Map<Long, List<TypeTreeVO>> 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static boolean isHasGroup(Long id) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,44 @@
|
|||||||
|
package com.engine.organization.enums;
|
||||||
|
|
||||||
|
import com.engine.salary.enums.BaseEnum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author weaver_cl
|
||||||
|
* @Description:
|
||||||
|
* @Date 2022/6/14
|
||||||
|
* @Version V1.0
|
||||||
|
**/
|
||||||
|
public enum ModuleTypeEnum implements BaseEnum<Integer> {
|
||||||
|
|
||||||
|
subcompanyfielddefined(1, "分部", -84967),
|
||||||
|
departmentfielddefined(2, "部门", -84967),
|
||||||
|
jobfielddefined(3, "岗位", -84967),
|
||||||
|
resourcefielddefined(4, "人员", -84967);
|
||||||
|
|
||||||
|
private int value;
|
||||||
|
|
||||||
|
private String defaultLabel;
|
||||||
|
|
||||||
|
private int labelId;
|
||||||
|
|
||||||
|
ModuleTypeEnum(int value, String defaultLabel, int labelId) {
|
||||||
|
this.value = value;
|
||||||
|
this.defaultLabel = defaultLabel;
|
||||||
|
this.labelId = labelId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer getLabelId() {
|
||||||
|
return labelId;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getDefaultLabel() {
|
||||||
|
return defaultLabel;
|
||||||
|
}
|
||||||
|
}
|
@ -1,12 +0,0 @@
|
|||||||
package com.engine.organization.enums;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Author weaver_cl
|
|
||||||
* @description:
|
|
||||||
* @Date 2022/6/14
|
|
||||||
* @Version V1.0
|
|
||||||
**/
|
|
||||||
public enum OrganizationTypeEnum {
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue