|
|
|
@ -86,12 +86,12 @@ public class DeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impleme |
|
|
|
|
} |
|
|
|
|
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()); |
|
|
|
|
if (!"0".equals(vo.getPid()) && null == parent) { |
|
|
|
|
throw new BusinessException(BaseResponseCode.DATA_ERROR); |
|
|
|
|
} |
|
|
|
|
/*SysDept oldParent = sysDeptMapper.selectById(sysDept.getPid()); |
|
|
|
|
*//*SysDept oldParent = sysDeptMapper.selectById(sysDept.getPid());
|
|
|
|
|
String oldRelationCode; |
|
|
|
|
String newRelationCode; |
|
|
|
|
//根目录降到其他目录
|
|
|
|
@ -104,16 +104,16 @@ public class DeptServiceImpl extends ServiceImpl<SysDeptMapper, SysDept> impleme |
|
|
|
|
} else { |
|
|
|
|
oldRelationCode = oldParent.getRelationCode(); |
|
|
|
|
newRelationCode = parent.getRelationCode(); |
|
|
|
|
}*/ |
|
|
|
|
/*LambdaQueryWrapper<SysDept> wrapper = Wrappers.lambdaQuery(); |
|
|
|
|
}*//*
|
|
|
|
|
*//*LambdaQueryWrapper<SysDept> wrapper = Wrappers.lambdaQuery();
|
|
|
|
|
wrapper.likeLeft(SysDept::getDeptNo, sysDept.getDeptNo()); |
|
|
|
|
List<SysDept> list = sysDeptMapper.selectList(wrapper); |
|
|
|
|
list.parallelStream().forEach(entity -> { |
|
|
|
|
String relationCode = entity.getRelationCode().replace(oldRelationCode, newRelationCode); |
|
|
|
|
entity.setRelationCode(relationCode); |
|
|
|
|
sysDeptMapper.updateById(entity); |
|
|
|
|
});*/ |
|
|
|
|
} |
|
|
|
|
});*//*
|
|
|
|
|
}*/ |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@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())); |
|
|
|
|
|
|
|
|
|
if (deptIds!=null&&deptIds.size()>0){ |
|
|
|
|
List<UserDept> list = userDeptMapper.selectList(Wrappers.<UserDept>lambdaQuery().in(UserDept::getDeptId, deptIds)); |
|
|
|
|
if (!CollectionUtils.isEmpty(list)) { |
|
|
|
|
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); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|