fix(系统管理): 修复部门树相关空指针异常

- 在 SysUserController 中为 selectDeptTree 方法添加空值检查
-避免当 deptService.selectDeptById 返回 null 时引发空指针异常
- 提高系统稳定性,防止未处理的空值导致的错误
master
chenhao 2025-04-14 15:33:36 +08:00
parent 5cc8591166
commit 1302d51986
1 changed files with 2 additions and 1 deletions
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system

View File

@ -349,7 +349,8 @@ public class SysUserController extends BaseController
@GetMapping("/selectDeptTree/{deptId}")
public String selectDeptTree(@PathVariable("deptId") Long deptId, ModelMap mmap)
{
mmap.put("dept", deptService.selectDeptById(deptId));
SysDept value = deptService.selectDeptById(deptId);
mmap.put("dept", value==null?new SysDept():value);
return prefix + "/deptTree";
}
}