| | |
| | | import org.springframework.util.CollectionUtils; |
| | | |
| | | import java.util.*; |
| | | import java.util.function.Function; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | } |
| | | return departmentVO; |
| | | } |
| | | |
| | | /** |
| | | * 批量获取部门的信息 (根据部门主键) |
| | | * @param deptOidCollections 部门主键的集合,可以超过1000个 |
| | |
| | | }); |
| | | return deptDO2VOs(depts); |
| | | } |
| | | |
| | | /** |
| | | * 获取部门的列表,默认会以部门名称升序排列,部门的编辑页面列表不要使用这个接口 |
| | | * @param queryMap 查询条件 |
| | |
| | | } |
| | | return dataGrid; |
| | | } |
| | | |
| | | /** |
| | | * 根据部门主键获取部门的姓名 |
| | | * @param deptOid 部门主键 |
| | |
| | | } |
| | | return deptDO2VOs(roles); |
| | | } |
| | | /** |
| | | |
| | | /** |
| | | * 根据用户主键获取关联的部门 |
| | | * @param userOid 用户主键 |
| | | * @param queryMap 查询条件,如果需要使用用户的属性来查询可以使用pkUser.xxxx |
| | |
| | | } |
| | | return departmentVOS.get(0); |
| | | } |
| | | |
| | | /** |
| | | * 获取未关联某个用户的部门 |
| | | * @param userOid 用户主键 |
| | |
| | | List<BusinessObject> cbos = boService.queryBySql(sql, null); |
| | | if(!CollectionUtils.isEmpty(cbos)){ |
| | | cbos.stream().forEach(cbo->{ |
| | | String userOid = ObjectTool.getBOAttributeValue(cbo,"pluseruid"); |
| | | String userOid = ObjectTool.getNewBOAttributeValue(cbo,"pluseruid"); |
| | | List<String> deptOids = userDeptOidMap.getOrDefault(userOid,new ArrayList<>()); |
| | | deptOids.add(ObjectTool.getBOAttributeValue(cbo,"pldeptuid")); |
| | | deptOids.add(ObjectTool.getNewBOAttributeValue(cbo,"pldeptuid")); |
| | | userDeptOidMap.put(userOid,deptOids); |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | if(!CollectionUtils.isEmpty(deptVOList)){ |
| | | Map<String, OrgDepartmentVO> deptVOMap = deptVOList.stream().collect(Collectors.toMap(s -> s.getOid(), t -> t)); |
| | | //这儿应该对deptVOList做一次去重处理,因为肯定会有重复的部门被查出来 |
| | | Map<String, OrgDepartmentVO> deptVOMap = deptVOList.stream() |
| | | .collect(Collectors.toMap(OrgDepartmentVO::getOid, Function.identity(), (existing, replacement) -> existing)); |
| | | //Map<String, OrgDepartmentVO> deptVOMap = deptVOList.stream().distinct().collect(Collectors.toMap(s -> s.getOid(), t -> t)); |
| | | Map<String, List<OrgDepartmentVO>> userDeptVOMap = new HashMap<>(); |
| | | userDeptOidMap.forEach((userOid,deptOids)->{ |
| | | List<OrgDepartmentVO> deptVOS = new ArrayList<>(); |
| | |
| | | } |
| | | return new HashMap<>(); |
| | | } |
| | | |
| | | /** |
| | | * 获取某个部门的直属下级部门 |
| | | * @param pkFatherDepartmment 部门的主键 |
| | |
| | | List<OrgDeptForPlatform1> depts = boService.selectByQueryWrapper(queryWrapperForDO, OrgDeptForPlatform1.class); |
| | | return deptDO2VOs(depts); |
| | | } |
| | | |
| | | /** |
| | | * 获取某个部门的所有层级的下级部门 |
| | | * @param pkFatherDepartmment 部门的主键 |
| | |
| | | queryWrapperForDO.in("pluid","select pluid from pldept start with " + (StringUtils.isBlank(pkFatherDepartmment)?" (plparentuid is null or plparentuid = '') ":"plparentuid = '" + pkFatherDepartmment.trim() + "'") + "connect by PRIOR pluid=plparentuid"); |
| | | return deptDO2VOs(boService.selectByQueryWrapper(queryWrapperForDO, OrgDeptForPlatform1.class)); |
| | | } |
| | | |
| | | /** |
| | | * 参照树形数据的部门信息 |
| | | * @param treeQueryObject 树形查询的条件 |
| | |
| | | return dept.getId() + " " + dept.getName() + (FrameworkDataLCStatus.DISABLED.getValue().equals(dept.getLcStatus())?"【停用】":""); |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 参照树形表格的部门信息,上级部门的是表格中的树形列 |
| | | * @param treeQueryObject 树形查询的条件 |