| | |
| | | /** |
| | | * 获取用户选择列表 |
| | | */ |
| | | @RequiresPermissions(value = {"/systemUserManagement", "/accountingStrategy/select", "/accountingStrategy", "/roleManagement/info"}, logical = Logical.OR) |
| | | @PostMapping("/getChangeUserList") |
| | | @ApiOperation(value = "获取用户选择列表", tags = {"管理后台-获取用户选择列表"}) |
| | | public AjaxResult<PageInfo<SysUser>> getChangeUserList(@RequestBody ChangeUserQuery query) { |
| | | return AjaxResult.success(userService.getChangeUserList(query)); |
| | | PageInfo<SysUser> pageInfo = userService.getChangeUserList(query); |
| | | if (pageInfo != null && pageInfo.getRecords() != null) { |
| | | pageInfo.getRecords().forEach(u -> u.setPassword(null)); |
| | | } |
| | | return AjaxResult.success(pageInfo); |
| | | } |
| | | |
| | | /** |
| | |
| | | /** |
| | | * 根据用户编号获取详细信息 |
| | | */ |
| | | @RequiresPermissions(value = {"/systemUserManagement/update"}, logical = Logical.OR) |
| | | @ApiOperation(value = "获取用户详情", tags = {"管理后台-系统用户管理"}) |
| | | @GetMapping("/getInfo/{userId}") |
| | | public AjaxResult getInfo(@PathVariable Long userId) { |
| | |
| | | List<Site> data = siteClient.getSiteByIds(siteIds).getData(); |
| | | List<String> siteNames = data.stream().map(Site::getName).collect(Collectors.toList()); |
| | | sysUser.setSiteNames(siteNames); |
| | | sysUser.setPassword(null); |
| | | ajax.put(AjaxResult.DATA_TAG, sysUser); |
| | | ajax.put("postIds", postService.selectPostListByUserId(userId)); |
| | | ajax.put("roleIds", sysUser.getRoles().stream().map(SysRole::getRoleId).collect(Collectors.toList())); |
| | |
| | | /** |
| | | * 获取当前用户信息 |
| | | */ |
| | | @InnerAuth |
| | | @GetMapping("/info/{username}") |
| | | public R<LoginUser> info(@PathVariable("username") String username) { |
| | | SysUser sysUser = userService.selectUserByUserName(username); |
| | |
| | | Set<String> roles = permissionService.getRolePermission(user); |
| | | // 权限集合 |
| | | Set<String> permissions = permissionService.getMenuPermission(user); |
| | | user.setPassword(null); |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("user", user); |
| | | ajax.put("roles", roles); |
| | |
| | | /** |
| | | * 状态修改 |
| | | */ |
| | | @RequiresPermissions(value = {"/systemUserManagement/forbidden"}, logical = Logical.OR) |
| | | @Log(title = "用户管理", businessType = BusinessType.UPDATE) |
| | | @PutMapping("/changeStatus") |
| | | public AjaxResult changeStatus(@RequestBody SysUser user) { |
| | |
| | | /** |
| | | * 根据用户编号获取授权角色 |
| | | */ |
| | | @RequiresPermissions(value = {"/systemUserManagement", "/roleManagement/info"}, logical = Logical.OR) |
| | | @GetMapping("/authRole/{userId}") |
| | | public AjaxResult authRole(@PathVariable("userId") Long userId) { |
| | | userService.checkUserDataScope(userId); |
| | | AjaxResult ajax = AjaxResult.success(); |
| | | SysUser user = userService.selectUserById(userId); |
| | | List<SysRole> roles = roleService.selectRolesByUserId(userId); |
| | | user.setPassword(null); |
| | | ajax.put("user", user); |
| | | ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList())); |
| | | return ajax; |
| | |
| | | /** |
| | | * 用户授权角色 |
| | | */ |
| | | @RequiresPermissions(value = {"/systemUserManagement/update", "/roleManagement/info"}, logical = Logical.OR) |
| | | @Log(title = "用户管理", businessType = BusinessType.GRANT) |
| | | @PutMapping("/authRole") |
| | | public AjaxResult insertAuthRole(Long userId, Long[] roleIds) { |
| | |
| | | /** |
| | | * 获取部门树列表 |
| | | */ |
| | | @RequiresPermissions(value = {"/systemUserManagement", "/roleManagement/info"}, logical = Logical.OR) |
| | | @GetMapping("/deptTree") |
| | | public AjaxResult deptTree(SysDept dept) { |
| | | return success(deptService.selectDeptTreeList(dept)); |