From 40aeeeced19e9dcc118836ab943b43f2eb594362 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=8A=93=E8=9B=99=E5=B8=88?= <770492966@qq.com> Date: Fri, 17 Feb 2023 11:16:17 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E9=83=A8=E9=97=A8id=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=9F=A5=E8=AF=A2=E5=88=B0=E9=83=A8=E9=97=A8=E7=9A=84?= =?UTF-8?q?=E7=A9=BA=E6=8C=87=E9=92=88=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java index ac934f90f..0e8894d7d 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysDeptServiceImpl.java @@ -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() .select(SysDept::getDeptName).eq(SysDept::getDeptId, dept.getParentId())); dept.setParentName(ObjectUtil.isNotNull(parentDept) ? parentDept.getDeptName() : null);