| | |
| | | {
|
| | | return deptMapper.selectDeptList(dept);
|
| | | }
|
| | | |
| | | /**
|
| | | * 查询部门树结构信息
|
| | | * |
| | | * @param dept 部门信息
|
| | | * @return 部门树信息集合
|
| | | */
|
| | | @Override
|
| | | public List<TreeSelect> selectDeptTreeList(SysDept dept)
|
| | | {
|
| | | List<SysDept> depts = SpringUtils.getAopProxy(this).selectDeptList(dept);
|
| | | return buildDeptTreeSelect(depts);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 构建前端所需要树结构
|
| | |
| | | public List<SysDept> buildDeptTree(List<SysDept> depts)
|
| | | {
|
| | | List<SysDept> returnList = new ArrayList<SysDept>();
|
| | | List<Long> tempList = new ArrayList<Long>();
|
| | | for (SysDept dept : depts)
|
| | | {
|
| | | tempList.add(dept.getDeptId());
|
| | | }
|
| | | List<Long> tempList = depts.stream().map(SysDept::getDeptId).collect(Collectors.toList());
|
| | | for (SysDept dept : depts)
|
| | | {
|
| | | // 如果是顶级节点, 遍历该父节点的所有子节点
|
| | |
| | | public boolean hasChildByDeptId(Long deptId)
|
| | | {
|
| | | int result = deptMapper.hasChildByDeptId(deptId);
|
| | | return result > 0 ? true : false;
|
| | | return result > 0;
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | public boolean checkDeptExistUser(Long deptId)
|
| | | {
|
| | | int result = deptMapper.checkDeptExistUser(deptId);
|
| | | return result > 0 ? true : false;
|
| | | return result > 0;
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | * @return 结果
|
| | | */
|
| | | @Override
|
| | | public String checkDeptNameUnique(SysDept dept)
|
| | | public boolean checkDeptNameUnique(SysDept dept)
|
| | | {
|
| | | Long deptId = StringUtils.isNull(dept.getDeptId()) ? -1L : dept.getDeptId();
|
| | | SysDept info = deptMapper.checkDeptNameUnique(dept.getDeptName(), dept.getParentId());
|
| | |
| | | @Override
|
| | | public void checkDeptDataScope(Long deptId)
|
| | | {
|
| | | if (!SysUser.isAdmin(SecurityUtils.getUserId()))
|
| | | if (!SysUser.isAdmin(SecurityUtils.getUserId()) && StringUtils.isNotNull(deptId))
|
| | | {
|
| | | SysDept dept = new SysDept();
|
| | | dept.setDeptId(deptId);
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * 查询顶层部门id
|
| | | * @param deptId
|
| | | * @return
|
| | | */
|
| | | @Override
|
| | | public Long maxLevelDeptId(Long deptId) {
|
| | | return deptMapper.maxLevelDeptId(deptId);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 递归列表
|
| | | */
|
| | | private void recursionFn(List<SysDept> list, SysDept t)
|