获取不到用户引发的NPE异常

Signed-off-by: g_l <glwxx0719@163.com>
This commit is contained in:
g_l 2024-05-16 02:33:01 +00:00 committed by Gitee
parent d46097a658
commit 4091253693
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -119,6 +119,7 @@ public class UserController {
@PreAuthorize("@ss.hasPermission('system:user:query')") @PreAuthorize("@ss.hasPermission('system:user:query')")
public CommonResult<UserRespVO> getUser(@RequestParam("id") Long id) { public CommonResult<UserRespVO> getUser(@RequestParam("id") Long id) {
AdminUserDO user = userService.getUser(id); AdminUserDO user = userService.getUser(id);
if (ObjectUtil.isEmpty(user)) return CommonResult.success(null);
// 拼接数据 // 拼接数据
DeptDO dept = deptService.getDept(user.getDeptId()); DeptDO dept = deptService.getDept(user.getDeptId());
return success(UserConvert.INSTANCE.convert(user, dept)); return success(UserConvert.INSTANCE.convert(user, dept));