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