fix 修复 解决部门id无法查询到部门的空指针异常
parent
2a031d7b44
commit
833dbda7e6
|
|
@ -115,6 +115,9 @@ public class SysDeptServiceImpl implements ISysDeptService {
|
||||||
@Override
|
@Override
|
||||||
public SysDept selectDeptById(Long deptId) {
|
public SysDept selectDeptById(Long deptId) {
|
||||||
SysDept dept = baseMapper.selectById(deptId);
|
SysDept dept = baseMapper.selectById(deptId);
|
||||||
|
if (ObjectUtil.isNull(dept)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
SysDept parentDept = baseMapper.selectOne(new LambdaQueryWrapper<SysDept>()
|
SysDept parentDept = baseMapper.selectOne(new LambdaQueryWrapper<SysDept>()
|
||||||
.select(SysDept::getDeptName).eq(SysDept::getDeptId, dept.getParentId()));
|
.select(SysDept::getDeptName).eq(SysDept::getDeptId, dept.getParentId()));
|
||||||
dept.setParentName(ObjectUtil.isNotNull(parentDept) ? parentDept.getDeptName() : null);
|
dept.setParentName(ObjectUtil.isNotNull(parentDept) ? parentDept.getDeptName() : null);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue