无关风月
2025-01-22 99367ea1c11a68b420936e7f7db5fa7367da4f44
xinquan-modules/xinquan-system/src/main/java/com/xinquan/system/controller/SysUserController.java
@@ -96,7 +96,14 @@
        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) {
@@ -109,7 +116,14 @@
            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()) {
@@ -128,6 +142,8 @@
    }
    @ApiOperation(value = "新增用户管理")
    @PostMapping("/add")
    @Log(title = "【系统用户】新增用户", businessType = BusinessType.INSERT)
    public AjaxResult add(@Validated @RequestBody SysUser user) {
        if (!userService.checkUserNameUnique(user))
        {
@@ -145,6 +161,8 @@
    }
    @ApiOperation(value = "修改用户管理")
    @PostMapping("/edit")
    @Log(title = "【系统用户】修改用户", businessType = BusinessType.UPDATE)
    public AjaxResult edit(@Validated @RequestBody SysUser user) {
//        userService.checkUserAllowed(user);
//        userService.checkUserDataScope(user.getUserId());
@@ -168,6 +186,8 @@
    @ApiOperation(value = "禁用启用")
    @PutMapping("/changeStatus")
    @Log(title = "【系统用户】修改状态", businessType = BusinessType.UPDATE)
    public AjaxResult changeStatus(@RequestBody SysUserUpdateStatusDTO dto)
    {
        SysUser user = new SysUser();
@@ -523,9 +543,10 @@
    /**
     * 删除用户
     */
    @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("当前用户不能删除");