修复部门删除问题

This commit is contained in:
TinyAnts 2022-09-15 11:38:40 +08:00
parent 193470d4ac
commit 060739454a
1 changed files with 9 additions and 0 deletions

View File

@ -205,6 +205,15 @@ class SystemAuthDeptServiceImpl implements ISystemAuthDeptService {
Assert.notNull(model, "部门不存在");
Assert.isFalse((model.getPid() == 0), "顶级部门不能删除");
SystemAuthDept pModel = systemAuthDeptMapper.selectOne(
new QueryWrapper<SystemAuthDept>()
.select("id,pid,name")
.eq("pid", id)
.eq("is_delete", 0)
.last("limit 1"));
Assert.isNull(pModel, "请先删除子级部门");
SystemAuthAdmin systemAuthAdmin = systemAuthAdminMapper.selectOne(new QueryWrapper<SystemAuthAdmin>()
.select("id,nickname")
.eq("dept_id", id)