部门管理 列表 字段文本展示

pull/17/MERGE^2
dxfeng 3 years ago
parent 39eebf62fc
commit cbd33dbd3b

@ -1,5 +1,7 @@
package com.engine.organization.entity.department.bo;
import com.engine.organization.entity.department.dto.DepartmentListDTO;
import com.engine.organization.entity.department.param.DeptSearchParam;
import com.engine.organization.entity.department.po.DepartmentPO;
import com.engine.organization.entity.department.vo.SingleDeptTreeVO;
import com.engine.organization.mapper.department.DepartmentMapper;
@ -7,8 +9,7 @@ import com.engine.organization.mapper.employee.EmployeeMapper;
import com.engine.organization.util.db.MapperProxyFactory;
import org.apache.commons.collections.CollectionUtils;
import java.util.Collections;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -19,6 +20,61 @@ import java.util.stream.Collectors;
**/
public class DepartmentBO {
public static List<DepartmentListDTO> buildDeptDTOList(Collection<DepartmentPO> list, List<DepartmentPO> filterList) {
// 搜索结果为空,直接返回空
if (CollectionUtils.isEmpty(filterList)) {
return Collections.emptyList();
}
// 递归添加父级数据
Map<Long, DepartmentPO> poMaps = list.stream().collect(Collectors.toMap(item -> item.getId(), item -> item));
List<DepartmentPO> addedList = new ArrayList<>();
for (DepartmentPO po : filterList) {
dealParentData(addedList, po, poMaps);
}
List<DepartmentListDTO> dtoList = addedList.stream().map(e -> DepartmentListDTO.builder()
.id(e.getId())
.deptNo(e.getDeptNo())
.deptName(e.getDeptName())
.deptNameShort(e.getDeptNameShort())
.parentComp(e.getParentComp() + "")// 命名
.parentDept(e.getParentDept())
.parentDeptName(null == poMaps.get(e.getParentDept()) ? "" : poMaps.get(e.getParentDept()).getDeptName())
.deptPrincipal(getEmployeeNameById((long) e.getDeptPrincipal()))
.showOrder(e.getShowOrder())
.forbiddenTag(e.getForbiddenTag())
.build()
).collect(Collectors.toList());
Map<Long, List<DepartmentListDTO>> collects = dtoList.stream().filter(item -> null != item.getParentDept() && 0 != item.getParentDept()).collect(Collectors.groupingBy(DepartmentListDTO::getParentDept));
System.out.println(collects);
return dtoList.stream().map(e -> {
System.out.println(e.getId());
System.out.println(collects.get(e.getId()));
e.setChildren(collects.get(e.getId()));
return e;
}).filter(item -> null == item.getParentDept() || 0 == item.getParentDept()).collect(Collectors.toList());
}
public static DepartmentPO convertParamsToPO(DeptSearchParam param, Long employeeId) {
if (null == param) {
return null;
}
return DepartmentPO.builder()
.id(param.getId() == null ? 0 : param.getId())
.deptNo(param.getDeptNo())
.deptName(param.getDeptName())
.deptNameShort(param.getDeptNameShort())
.parentComp(param.getParentComp())
.parentDept(param.getParentDept())
.deptPrincipal(param.getDeptPrincipal())
.showOrder(param.getShowOrder())
.forbiddenTag(param.getForbiddenTag() == null ? null : param.getForbiddenTag() ? 0 : 1)
.deleteType(0)
.createTime(new Date())
.updateTime(new Date())
.creator(employeeId).build();
}
public static List<SingleDeptTreeVO> buildSingleDeptTreeVOS(List<DepartmentPO> departmentPOs) {
if (CollectionUtils.isEmpty(departmentPOs)) {
@ -29,7 +85,7 @@ public class DepartmentBO {
List<SingleDeptTreeVO> singleDeptTreeVOS = departmentPOs.stream().map(e -> SingleDeptTreeVO.builder()
.id(e.getId())
.deptName(e.getDeptName())
.parentDeptName(getDeptNameById(e.getParentDept()))
.parentDeptName(getDeptNameById(e.getParentDept().intValue()))
.deptPrincipalName(getEmployeeNameById((long) e.getDeptPrincipal()))
.children(recursiveData(e.getId()))
.build()
@ -40,7 +96,7 @@ public class DepartmentBO {
}
public static String getDeptNameById(int id) {
public static String getDeptNameById(Integer id) {
return MapperProxyFactory.getProxy(DepartmentMapper.class).getDeptNameById(id);
}
@ -49,8 +105,26 @@ public class DepartmentBO {
}
/**
*
*
* @param addedList
* @param po
* @param poMaps
*/
private static void dealParentData(List<DepartmentPO> addedList, DepartmentPO po, Map<Long, DepartmentPO> poMaps) {
if (!addedList.contains(po)) {
addedList.add(po);
}
DepartmentPO parentPO = poMaps.get(po.getParentDept());
if (null != parentPO) {
dealParentData(addedList, parentPO, poMaps);
}
}
/**
*
*
* @param parentDeptId
* @return
*/
@ -63,7 +137,7 @@ public class DepartmentBO {
List<SingleDeptTreeVO> singleDeptTreeVOS = departmentPOS.stream().map(e -> SingleDeptTreeVO.builder()
.id(e.getId())
.deptName(e.getDeptName())
.parentDeptName(getDeptNameById(e.getParentDept()))
.parentDeptName(getDeptNameById(e.getParentDept().intValue()))
.deptPrincipalName(getEmployeeNameById((long) e.getDeptPrincipal()))
.children(recursiveData(e.getId()))
.build()
@ -73,5 +147,4 @@ public class DepartmentBO {
}
}

@ -0,0 +1,98 @@
package com.engine.organization.entity.department.dto;
import com.cloudstore.eccom.pc.table.WeaTableType;
import com.engine.organization.annotation.OrganizationTable;
import com.engine.organization.annotation.OrganizationTableOperate;
import com.engine.organization.annotation.TableTitle;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @Author weaver_cl
* @Description: TODO
* @Date 2022/5/19
* @Version V1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@OrganizationTable(pageId = "96f2bb0d-da73-11ec-a0da-00ffcbed7508",
tableType = WeaTableType.NONE,
operates = {
@OrganizationTableOperate(index = "0", text = "编辑"),
@OrganizationTableOperate(index = "1", text = "删除"),
@OrganizationTableOperate(index = "2", text = "合并"),
@OrganizationTableOperate(index = "3", text = "转移"),
@OrganizationTableOperate(index = "4", text = "联查岗位"),
@OrganizationTableOperate(index = "4", text = "联查人员")
})
public class DepartmentListDTO {
private Long id;
/**
*
*/
@TableTitle(title = "编号", dataIndex = "deptNo", key = "deptNo")
private String deptNo;
/**
*
*/
@TableTitle(title = "名称", dataIndex = "deptName", key = "deptName")
private String deptName;
/**
*
*/
@TableTitle(title = "简称", dataIndex = "deptNameShort", key = "deptNameShort")
private String deptNameShort;
/**
*
*/
@TableTitle(title = "所属分部", dataIndex = "parentComp", key = "parentComp")
private String parentComp;
/**
*
*/
@TableTitle(title = "上级部门", dataIndex = "parentDeptName", key = "parentDeptName")
private String parentDeptName;
private Long parentDept;
/**
*
*/
@TableTitle(title = "部门负责人", dataIndex = "deptPrincipal", key = "deptPrincipal")
private String deptPrincipal;
/**
*
*/
@TableTitle(title = "显示顺序", dataIndex = "showOrder", key = "showOrder")
private int showOrder;
/**
*
*/
@TableTitle(title = "说明", dataIndex = "description", key = "description")
private String description;
/**
*
*/
@TableTitle(title = "禁用标记", dataIndex = "forbiddenTag", key = "forbiddenTag")
private int forbiddenTag;
/**
*
*/
private List<DepartmentListDTO> children;
}

@ -0,0 +1,37 @@
package com.engine.organization.entity.department.param;
import com.engine.organization.common.BaseQueryParam;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @description: TODO
* @author:dxfeng
* @createTime: 2022/05/23
* @version: 1.0
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class DeptSearchParam extends BaseQueryParam {
private Long id;
private String deptNo;
private String deptName;
private String deptNameShort;
private Long parentComp;
private Long parentDept;
private Integer deptPrincipal;
private Integer showOrder;
private Boolean forbiddenTag;
}

@ -27,17 +27,17 @@ public class DepartmentPO {
private String deptNameShort;
private int parentComp;
private Long parentComp;
private int parentDept;
private Long parentDept;
private int deptPrincipal; //部门负责人
private Integer deptPrincipal; //部门负责人
private int showOrder;
private Integer showOrder;
private String description;
private int forbiddenTag;
private Integer forbiddenTag;
private Long creator;

@ -3,6 +3,7 @@ package com.engine.organization.mapper.department;
import com.engine.organization.entity.department.po.DepartmentPO;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
/**
@ -17,5 +18,24 @@ public interface DepartmentMapper {
List<DepartmentPO> getDeptListByPId(@Param("PId") Long PId);
List<DepartmentPO> getDeptList(DepartmentPO departmentPO);
/**
*
*
* @return
*/
List<DepartmentPO> listParent();
/**
*
*
* @param ids
* @return
*/
List<DepartmentPO> listChild(@Param("ids") Collection ids);
DepartmentPO getDeptById(@Param("id") int id);
String getDeptNameById(@Param("id") int id);
}

@ -1,7 +1,22 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.engine.organization.mapper.department.DepartmentMapper">
<resultMap id="BaseResultMap" type="com.engine.organization.entity.department.po.DepartmentPO">
<result column="id" property="id"/>
<result column="dept_no" property="deptNo"/>
<result column="dept_name" property="deptName"/>
<result column="dept_name_short" property="deptNameShort"/>
<result column="parent_comp" property="parentComp"/>
<result column="parent_dept" property="parentDept"/>
<result column="dept_principal" property="deptPrincipal"/>
<result column="show_order" property="showOrder"/>
<result column="description" property="description"/>
<result column="forbidden_tag" property="forbiddenTag"/>
<result column="creator" property="creator"/>
<result column="delete_type" property="deleteType"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<select id="getDeptListByCompId" resultType="com.engine.organization.entity.department.po.DepartmentPO">
select t.id, t.dept_name, t.parent_dept, t.dept_principal
@ -23,5 +38,135 @@
where id = #{id}
</select>
<select id="getDeptList" parameterType="com.engine.organization.entity.department.po.DepartmentPO"
resultMap="BaseResultMap">
select t.id,
t.dept_no,
t.dept_name,
t.dept_name_short,
t.parent_comp,
t.parent_dept,
t.dept_principal,
t.show_order,
t.forbidden_tag
from jcl_org_dept t
where delete_type = 0
<include refid="likeSQL"/>
<if test=" parentComp != null ">
and t.parent_comp = #{parentComp}
</if>
<if test=" parentDept != null ">
and t.parent_dept = #{parentDept}
</if>
<if test=" deptPrincipal != null ">
and t.dept_principal = #{deptPrincipal}
</if>
<if test=" showOrder != null ">
and t.show_order = #{showOrder}
</if>
<if test=" showOrder != null ">
and t.forbidden_tag = #{forbiddenTag}
</if>
</select>
<select id="getDeptById" resultType="com.engine.organization.entity.department.po.DepartmentPO">
select t.id,
t.dept_no,
t.dept_name,
t.dept_name_short,
t.parent_comp,
t.parent_dept,
t.dept_principal,
t.show_order,
t.forbidden_tag
from jcl_org_dept t
where delete_type = 0
and id = #{id}
</select>
<select id="listParent" resultMap="BaseResultMap">
SELECT
t.id,
t.dept_no,
t.dept_name,
t.dept_name_short,
t.parent_comp,
t.parent_dept,
t.dept_principal,
t.show_order,
t.forbidden_tag
FROM
jcl_org_dept t
WHERE t.delete_type = 0
<include refid="nullSql"/>
</select>
<select id="listChild" resultMap="BaseResultMap">
SELECT
t.id,
t.dept_no,
t.dept_name,
t.dept_name_short,
t.parent_comp,
t.parent_dept,
t.dept_principal,
t.show_order,
t.forbidden_tag
FROM
jcl_org_dept t
WHERE t.delete_type = 0
AND parent_dept IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</select>
<sql id="likeSQL">
<if test=" deptNo != null and deptNo != '' ">
and t.dept_no like CONCAT('%',#{deptNo},'%')
</if>
<if test=" deptName != null and deptName != '' ">
and t.dept_name like CONCAT('%',#{deptName},'%')
</if>
<if test=" deptNameShort != null and deptNameShort != '' ">
and t.dept_name_short like CONCAT('%',#{deptNameShort},'%')
</if>
</sql>
<sql id="likeSQL" databaseId="oracle">
<if test=" deptNo != null and deptNo != '' ">
and t.dept_no like '%'||#{deptNo}||'%'
</if>
<if test=" deptName != null and deptName != '' ">
and t.dept_name like '%'||#{deptName}||'%'
</if>
<if test=" deptNameShort != null and deptNameShort != '' ">
and t.dept_name_short like '%'||#{deptNameShort}||'%'
</if>
</sql>
<sql id="likeSQL" databaseId="sqlserver">
<if test=" deptNo != null and deptNo != '' ">
and t.dept_no like '%'+#{deptNo}+'%'
</if>
<if test=" deptName != null and deptName != '' ">
and t.dept_name like '%'+#{deptName}+'%'
</if>
<if test=" deptNameShort != null and deptNameShort != '' ">
and t.dept_name_short like '%'+#{deptNameShort}+'%'
</if>
</sql>
<sql id="nullSql">
and ifnull(parent_dept,'0')='0'
</sql>
<sql id="nullSql" databaseId="sqlserver">
and isnull(parent_dept,'0')='0'
</sql>
<sql id="nullSql" databaseId="oracle">
and NVL(parent_dept,'0')='0'
</sql>
</mapper>

@ -1,9 +1,12 @@
package com.engine.organization.service;
import com.engine.organization.entity.department.param.DeptSearchParam;
import com.engine.organization.entity.department.param.QuerySingleDeptListParam;
import com.engine.organization.entity.department.vo.SingleDeptTreeVO;
import com.engine.organization.util.page.PageInfo;
import java.util.Map;
/**
* @Author weaver_cl
* @Description: TODO
@ -15,8 +18,19 @@ public interface DepartmentService {
/**
* idtree
*
*
* @param param
* @return
*/
PageInfo<SingleDeptTreeVO> getDeptListByPid(QuerySingleDeptListParam param);
/**
*
*
* @param param
* @return
*/
public Map<String, Object> listPage(DeptSearchParam param);
}

@ -91,8 +91,10 @@ public class CompServiceImpl extends Service implements CompService {
List<CompPO> list = new ArrayList<>();
list.addAll(parentList);
if (CollectionUtils.isNotEmpty(parentList)) {
// 递归查询子数据
getChildPOs(parentList, list);
}
CompPO compPO = CompBO.convertParamToPO(params, (long) user.getUID());
// 搜索条件过滤数据

@ -1,17 +1,26 @@
package com.engine.organization.service.impl;
import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.cloudstore.eccom.result.WeaResultMsg;
import com.engine.core.impl.Service;
import com.engine.organization.component.OrganizationWeaTable;
import com.engine.organization.entity.department.bo.DepartmentBO;
import com.engine.organization.entity.department.dto.DepartmentListDTO;
import com.engine.organization.entity.department.param.DeptSearchParam;
import com.engine.organization.entity.department.param.QuerySingleDeptListParam;
import com.engine.organization.entity.department.po.DepartmentPO;
import com.engine.organization.entity.department.vo.SingleDeptTreeVO;
import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.service.DepartmentService;
import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.page.Column;
import com.engine.organization.util.page.PageInfo;
import com.engine.organization.util.page.PageUtil;
import org.apache.commons.collections4.CollectionUtils;
import weaver.general.StringUtil;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Author weaver_cl
@ -20,7 +29,9 @@ import java.util.List;
* @Version V1.0
**/
public class DepartmentServiceImpl extends Service implements DepartmentService {
private DepartmentMapper getDepartmentMapper() {
return MapperProxyFactory.getProxy(DepartmentMapper.class);
}
@Override
public PageInfo<SingleDeptTreeVO> getDeptListByPid(QuerySingleDeptListParam param) {
@ -36,4 +47,88 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
return pageInfos;
}
@Override
public Map<String, Object> listPage(DeptSearchParam param) {
Map<String, Object> datas = new HashMap<>();
PageUtil.start(param.getCurrent(), param.getPageSize());
List<DepartmentPO> parentList = getDepartmentMapper().listParent();
List<DepartmentPO> list = new ArrayList<>();
list.addAll(parentList);
if(CollectionUtils.isNotEmpty(parentList)) {
// 递归查询子数据
getChildPOs(parentList, list);
}
DepartmentPO departmentPO = DepartmentBO.convertParamsToPO(param, (long) user.getUID());
// 搜索条件过滤数据
List<DepartmentPO> filterList = filterListByParams(list, departmentPO);
List<DepartmentListDTO> departmentListDTOS = DepartmentBO.buildDeptDTOList(list, filterList);
PageInfo<DepartmentListDTO> pageInfos = new PageInfo<>(departmentListDTOS, DepartmentListDTO.class);
pageInfos.setTotal(pageInfos.getTotal());
pageInfos.setPageNum(param.getCurrent());
pageInfos.setPageSize(param.getPageSize());
OrganizationWeaTable<DepartmentListDTO> table = new OrganizationWeaTable<>(user, DepartmentListDTO.class);
List<Column> columns = pageInfos.getColumns();
List<WeaTableColumn> weaTableColumn = columns.stream().map(v -> new WeaTableColumn("100", v.getTitle(), v.getKey())).collect(Collectors.toList());
table.setColumns(weaTableColumn);
WeaResultMsg result = new WeaResultMsg(false);
result.putAll(table.makeDataResult());
result.success();
datas.put("pageInfo", pageInfos);
datas.put("dataKey", result.getResultMap());
return datas;
}
/**
* list
*
* @param departmentPOS
* @param departmentPO
* @return
*/
private List<DepartmentPO> filterListByParams(Collection<DepartmentPO> departmentPOS, DepartmentPO departmentPO) {
// 搜索后的数据
List<DepartmentPO> filterList = new ArrayList<>();
// 筛选数据
for (Iterator<DepartmentPO> iterator = departmentPOS.iterator(); iterator.hasNext(); ) {
DepartmentPO next = iterator.next();
boolean isAdd = (StringUtil.isEmpty(departmentPO.getDeptName()) || next.getDeptName().contains(departmentPO.getDeptName())) // 名称
&& (StringUtil.isEmpty(departmentPO.getDeptNo()) || next.getDeptNo().contains(departmentPO.getDeptNo()))//编号
&& (StringUtil.isEmpty(departmentPO.getDeptNameShort()) || next.getDeptNameShort().contains(departmentPO.getDeptNameShort()))//简称
&& (null == departmentPO.getParentComp() || next.getParentComp().equals(departmentPO.getParentComp()))//所属分部
&& (null == departmentPO.getParentDept() || next.getParentDept().equals(departmentPO.getParentDept()))//上级部门
&& (null == departmentPO.getDeptPrincipal() || next.getDeptPrincipal().equals(departmentPO.getDeptPrincipal()))//部门负责人
&& (null == departmentPO.getShowOrder() || next.getShowOrder().equals(departmentPO.getShowOrder()))//显示顺序
&& (null == departmentPO.getForbiddenTag() || next.getForbiddenTag().equals(departmentPO.getForbiddenTag()));//禁用标记
if (isAdd) {
filterList.add(next);
}
}
return filterList;
}
/**
*
*
* @param parentList
* @param list
*/
private void getChildPOs(List<DepartmentPO> parentList, List<DepartmentPO> list) {
List<Long> ids = parentList.stream().map(DepartmentPO::getId).collect(Collectors.toList());
List<DepartmentPO> listChild = getDepartmentMapper().listChild(ids);
if (CollectionUtils.isNotEmpty(listChild)) {
list.addAll(listChild);
getChildPOs(listChild, list);
}
}
}

@ -1,6 +1,7 @@
package com.engine.organization.web;
import com.engine.common.util.ServiceUtil;
import com.engine.organization.entity.department.param.DeptSearchParam;
import com.engine.organization.entity.department.param.QuerySingleDeptListParam;
import com.engine.organization.util.response.ReturnResult;
import com.engine.organization.wrapper.DepartmentWrapper;
@ -32,8 +33,7 @@ public class DepartmentController {
@POST
@Path("/getDeptListByPid")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult getDeptListByPid(@Context HttpServletRequest request, @Context HttpServletResponse response,
@RequestBody QuerySingleDeptListParam querySingleDeptListParam) {
public ReturnResult getDeptListByPid(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody QuerySingleDeptListParam querySingleDeptListParam) {
try {
User user = HrmUserVarify.getUser(request, response);
return getDepartmentWrapper(user).getDeptListByPid(querySingleDeptListParam);
@ -41,4 +41,25 @@ public class DepartmentController {
return ReturnResult.exceptionHandle(e.getMessage());
}
}
/**
* list
*
* @param request
* @param response
* @param params
* @return
*/
@POST
@Path("/listDept")
@Produces(MediaType.APPLICATION_JSON)
public ReturnResult listDept(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody DeptSearchParam params) {
try {
User user = HrmUserVarify.getUser(request, response);
return ReturnResult.successed(getDepartmentWrapper(user).listPage(params));
} catch (Exception e) {
return ReturnResult.exceptionHandle(e.getMessage());
}
}
}

@ -0,0 +1,30 @@
package com.engine.organization.webservice;
import com.engine.organization.entity.comp.po.CompPO;
import javax.jws.WebMethod;
import javax.jws.WebService;
import java.util.List;
/**
* @description: TODO
* @author:dxfeng
* @createTime: 2022/05/23
* @version: 1.0
*/
@WebService
public interface CustomBrowserService {
/**
* /
*
*
* @return
*/
@WebMethod(
operationName = "getCompTreeList",
action = "com.engine.organization.webservice.CustomBrowserService.getCompTreeList"
)
List<CompPO> getCompTreeList();
}

@ -0,0 +1,53 @@
package com.engine.organization.webservice;
import com.engine.organization.entity.comp.po.CompPO;
import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.util.db.MapperProxyFactory;
import org.apache.commons.collections4.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @description: TODO
* @author:dxfeng
* @createTime: 2022/05/23
* @version: 1.0
*/
public class CustomBrowserServiceImpl implements CustomBrowserService {
private CompMapper getCompMapper() {
return MapperProxyFactory.getProxy(CompMapper.class);
}
@Override
public List<CompPO> getCompTreeList() {
// 获取所有启用数据
List<CompPO> allList = getCompMapper().list().stream().filter(item -> 0 == item.getForbiddenTag()).collect(Collectors.toList());
List<CompPO> parentList = allList.stream().filter(item -> (null == item.getParentCompany() || 0 == item.getParentCompany())).collect(Collectors.toList());
Map<Long, List<CompPO>> compMap = allList.stream().filter(item -> (null != item.getParentCompany() && 0 != item.getParentCompany())).collect(Collectors.groupingBy(CompPO::getParentCompany));
List<CompPO> returnList = new ArrayList<>();
dealChildren(parentList, returnList, compMap);
return returnList;
}
/**
*
*
* @param parentList
* @param returnList
* @param compMap
*/
private void dealChildren(List<CompPO> parentList, List<CompPO> returnList, Map<Long, List<CompPO>> compMap) {
if (CollectionUtils.isEmpty(parentList)) {
return;
}
for (CompPO compPO : parentList) {
returnList.add(compPO);
dealChildren(compMap.get(compPO.getId()), returnList, compMap);
}
}
}

@ -2,6 +2,7 @@ package com.engine.organization.wrapper;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.organization.entity.department.param.DeptSearchParam;
import com.engine.organization.entity.department.param.QuerySingleDeptListParam;
import com.engine.organization.service.DepartmentService;
import com.engine.organization.service.impl.DepartmentServiceImpl;
@ -10,6 +11,8 @@ import com.engine.organization.util.response.ReturnResult;
import com.engine.organization.entity.department.vo.SingleDeptTreeVO;
import weaver.hrm.User;
import java.util.Map;
/**
* @Author weaver_cl
* @Description: TODO
@ -26,4 +29,14 @@ public class DepartmentWrapper extends Service {
PageInfo<SingleDeptTreeVO> singleDeptTreeVOS = getDepartmentService(user).getDeptListByPid(param);
return ReturnResult.successed(singleDeptTreeVOS);
}
/**
*
*
* @param param
* @return
*/
public Map<String, Object> listPage(DeptSearchParam param) {
return getDepartmentService(user).listPage(param);
}
}

Loading…
Cancel
Save