|
|
@ -86,12 +86,12 @@ public class DeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impleme |
|
|
|
} |
|
|
|
} |
|
|
|
sysDeptMapper.updateById(vo); |
|
|
|
sysDeptMapper.updateById(vo); |
|
|
|
//说明层级发生了变化
|
|
|
|
//说明层级发生了变化
|
|
|
|
if (!StringUtils.isEmpty(vo.getPid()) && !vo.getPid().equals(sysDept.getPid())) { |
|
|
|
/*if (!StringUtils.isEmpty(vo.getPid()) && !vo.getPid().equals(sysDept.getPid())) { |
|
|
|
SysDept parent = sysDeptMapper.selectById(vo.getPid()); |
|
|
|
SysDept parent = sysDeptMapper.selectById(vo.getPid()); |
|
|
|
if (!"0".equals(vo.getPid()) && null == parent) { |
|
|
|
if (!"0".equals(vo.getPid()) && null == parent) { |
|
|
|
throw new BusinessException(BaseResponseCode.DATA_ERROR); |
|
|
|
throw new BusinessException(BaseResponseCode.DATA_ERROR); |
|
|
|
} |
|
|
|
} |
|
|
|
/*SysDept oldParent = sysDeptMapper.selectById(sysDept.getPid()); |
|
|
|
*//*SysDept oldParent = sysDeptMapper.selectById(sysDept.getPid());
|
|
|
|
String oldRelationCode; |
|
|
|
String oldRelationCode; |
|
|
|
String newRelationCode; |
|
|
|
String newRelationCode; |
|
|
|
//根目录降到其他目录
|
|
|
|
//根目录降到其他目录
|
|
|
@ -104,16 +104,16 @@ public class DeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impleme |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
oldRelationCode = oldParent.getRelationCode(); |
|
|
|
oldRelationCode = oldParent.getRelationCode(); |
|
|
|
newRelationCode = parent.getRelationCode(); |
|
|
|
newRelationCode = parent.getRelationCode(); |
|
|
|
}*/ |
|
|
|
}*//*
|
|
|
|
/*LambdaQueryWrapper<SysDept> wrapper = Wrappers.lambdaQuery(); |
|
|
|
*//*LambdaQueryWrapper<SysDept> wrapper = Wrappers.lambdaQuery();
|
|
|
|
wrapper.likeLeft(SysDept::getDeptNo, sysDept.getDeptNo()); |
|
|
|
wrapper.likeLeft(SysDept::getDeptNo, sysDept.getDeptNo()); |
|
|
|
List<SysDept> list = sysDeptMapper.selectList(wrapper); |
|
|
|
List<SysDept> list = sysDeptMapper.selectList(wrapper); |
|
|
|
list.parallelStream().forEach(entity -> { |
|
|
|
list.parallelStream().forEach(entity -> { |
|
|
|
String relationCode = entity.getRelationCode().replace(oldRelationCode, newRelationCode); |
|
|
|
String relationCode = entity.getRelationCode().replace(oldRelationCode, newRelationCode); |
|
|
|
entity.setRelationCode(relationCode); |
|
|
|
entity.setRelationCode(relationCode); |
|
|
|
sysDeptMapper.updateById(entity); |
|
|
|
sysDeptMapper.updateById(entity); |
|
|
|
});*/ |
|
|
|
});*//*
|
|
|
|
} |
|
|
|
}*/ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
@ -124,10 +124,20 @@ public class DeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impleme |
|
|
|
} |
|
|
|
} |
|
|
|
List<Object> deptIds = sysDeptMapper.selectObjs(Wrappers.<SysDept>lambdaQuery().select(SysDept::getId).likeRight(SysDept::getRelationCode, sysDept.getRelationCode())); |
|
|
|
List<Object> deptIds = sysDeptMapper.selectObjs(Wrappers.<SysDept>lambdaQuery().select(SysDept::getId).likeRight(SysDept::getRelationCode, sysDept.getRelationCode())); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (deptIds!=null&&deptIds.size()>0){ |
|
|
|
List<UserDept> list = userDeptMapper.selectList(Wrappers.<UserDept>lambdaQuery().in(UserDept::getDeptId, deptIds)); |
|
|
|
List<UserDept> list = userDeptMapper.selectList(Wrappers.<UserDept>lambdaQuery().in(UserDept::getDeptId, deptIds)); |
|
|
|
if (!CollectionUtils.isEmpty(list)) { |
|
|
|
if (!CollectionUtils.isEmpty(list)) { |
|
|
|
throw new BusinessException(BaseResponseCode.NOT_PERMISSION_DELETED_DEPT); |
|
|
|
throw new BusinessException(BaseResponseCode.NOT_PERMISSION_DELETED_DEPT); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
//查询是否有子级部门
|
|
|
|
|
|
|
|
QueryWrapper<SysDept> deptQueryWrapper = new QueryWrapper<>(); |
|
|
|
|
|
|
|
deptQueryWrapper.eq("pid",sysDept.getId()); |
|
|
|
|
|
|
|
List<SysDept> sysDepts = sysDeptMapper.selectList(deptQueryWrapper); |
|
|
|
|
|
|
|
if (sysDepts!=null&& sysDepts.size()>0){ |
|
|
|
|
|
|
|
throw new BusinessException(BaseResponseCode.DELETE_SUB_DEPARTMENTS_FIRST); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
sysDeptMapper.deleteById(id); |
|
|
|
sysDeptMapper.deleteById(id); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|