Browse Source

减少一次sql查询(SysUser对象包含了角色列表)

减少一次sql查询(SysUser对象包含了角色列表)
tags/v3.4.0
runphp 3 years ago committed by Gitee
parent
commit
9bf5dfdc5f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
  1. 5
      ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java

5
ruoyi-modules/ruoyi-system/src/main/java/com/ruoyi/system/controller/SysUserController.java

@ -179,9 +179,10 @@ public class SysUserController extends BaseController @@ -179,9 +179,10 @@ public class SysUserController extends BaseController
ajax.put("posts", postService.selectPostAll());
if (StringUtils.isNotNull(userId))
{
ajax.put(AjaxResult.DATA_TAG, userService.selectUserById(userId));
SysUser sysUser = userService.selectUserById(userId);
ajax.put(AjaxResult.DATA_TAG, sysUser);
ajax.put("postIds", postService.selectPostListByUserId(userId));
ajax.put("roleIds", roleService.selectRoleListByUserId(userId));
ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList()));
}
return ajax;
}

Loading…
Cancel
Save