| | |
| | | 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()) { |
| | |
| | | @PostMapping("/app-register") |
| | | public R<SysUser> appRegister(@RequestBody SysUser sysUser) { |
| | | String username = sysUser.getUserName(); |
| | | if (!userService.checkAppUserNameUnique(sysUser)) { |
| | | return R.fail("保存用户'" + username + "'失败,注册账号已存在"); |
| | | } |
| | | |
| | | //添加用户 |
| | | userService.registerUser(sysUser); |
| | | return R.ok(sysUser); |