fix 修复 解决部门id无法查询到部门的空指针异常

2.X
疯狂的狮子li 2 years ago
parent 2a031d7b44
commit 833dbda7e6

@ -115,6 +115,9 @@ public class SysDeptServiceImpl implements ISysDeptService {
@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…
Cancel
Save