| | |
| | | for (SysUserVO record : list.getRecords()) { |
| | | List<Long> collect1 = sysUserRoleService.lambdaQuery().eq(SysUserRole::getUserId, record.getUserId()) |
| | | .list().stream().map(SysUserRole::getRoleId).collect(Collectors.toList()); |
| | | record.setRole(collect1); |
| | | List<Long> longs1 = new ArrayList<>(); |
| | | for (Long l : collect1) { |
| | | SysRole sysDept = roleService.selectRoleById(l); |
| | | if (sysDept!=null){ |
| | | longs1.add(sysDept.getRoleId()); |
| | | } |
| | | } |
| | | record.setRole(longs1); |
| | | List<String> strings1 = new ArrayList<>(); |
| | | if (record.getRole()!=null && (!record.getRole().isEmpty())){ |
| | | for (Long l : collect1) { |
| | |
| | | record.setRoleNames(strings1); |
| | | List<Long> collect2 = sysUserDeptService.lambdaQuery().eq(SysUserDept::getUserId, record.getUserId()) |
| | | .list().stream().map(SysUserDept::getDeptId).collect(Collectors.toList()); |
| | | record.setDeptIds(collect2); |
| | | List<Long> longs2 = new ArrayList<>(); |
| | | for (Long l : collect2) { |
| | | SysDept sysDept = deptService.selectDeptById(l); |
| | | if (sysDept!=null){ |
| | | longs2.add(sysDept.getDeptId()); |
| | | } |
| | | } |
| | | record.setDeptIds(longs2); |
| | | List<String> strings = new ArrayList<>(); |
| | | if (record.getDeptIds()!=null && (!record.getDeptIds().isEmpty())){ |
| | | for (Long deptId : record.getDeptIds()) { |
| | |
| | | } |
| | | @ApiOperation(value = "新增用户管理") |
| | | @PostMapping("/add") |
| | | @Log(title = "【系统用户】新增用户", businessType = BusinessType.INSERT) |
| | | |
| | | public AjaxResult add(@Validated @RequestBody SysUser user) { |
| | | if (!userService.checkUserNameUnique(user)) |
| | | { |
| | |
| | | } |
| | | @ApiOperation(value = "修改用户管理") |
| | | @PostMapping("/edit") |
| | | @Log(title = "【系统用户】修改用户", businessType = BusinessType.UPDATE) |
| | | |
| | | public AjaxResult edit(@Validated @RequestBody SysUser user) { |
| | | // userService.checkUserAllowed(user); |
| | | // userService.checkUserDataScope(user.getUserId()); |
| | |
| | | |
| | | @ApiOperation(value = "禁用启用") |
| | | @PutMapping("/changeStatus") |
| | | @Log(title = "【系统用户】修改状态", businessType = BusinessType.UPDATE) |
| | | |
| | | public AjaxResult changeStatus(@RequestBody SysUserUpdateStatusDTO dto) |
| | | { |
| | | SysUser user = new SysUser(); |
| | |
| | | /** |
| | | * 删除用户 |
| | | */ |
| | | @Log(title = "用户管理", businessType = BusinessType.DELETE) |
| | | @Log(title = "【用户管理】删除", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{userIds}") |
| | | @ApiOperation("删除管理员") |
| | | |
| | | public AjaxResult remove(@PathVariable Long[] userIds) { |
| | | if (ArrayUtils.contains(userIds, SecurityUtils.getUserId())) { |
| | | return error("当前用户不能删除"); |