Commit a14e42ad by HlQ

[chg] 优化代码

1 parent ef75b2f3
......@@ -64,7 +64,7 @@ public class UserController {
@GetMapping("/user")
@SaCheckPermission(value = "user:query", orRole = "admin")
public User getUserById(@RequestParam(name = "id") Integer id) {
public User getUserById(@RequestParam Long id) {
return userService.getById(id);
}
......@@ -89,8 +89,7 @@ public class UserController {
@GetMapping("/user/role/{id}")
@SaCheckPermission(value = "user:role", orRole = "admin")
public List<RoleVO> listRoleById(@PathVariable Long id) {
List<RUserRole> userRoleList = userRoleService.lambdaQuery().eq(RUserRole::getUserId, id).list();
List<Role> roleList = Opt.ofEmptyAble(userRoleList)
List<Role> roleList = Opt.ofEmptyAble(userRoleService.lambdaQuery().eq(RUserRole::getUserId, id).list())
.map(l -> l.stream().map(RUserRole::getRoleId).collect(Collectors.toList()))
.filter(CollUtil::isNotEmpty)
.map(roleIdList -> roleService.lambdaQuery().in(Role::getId, roleIdList).list())
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!