mirror of https://gitee.com/stylefeng/roses
【system】更新用户的字段
parent
a6aa6c3262
commit
e9f97873ee
|
@ -6,8 +6,8 @@ import cn.stylefeng.roses.kernel.resource.api.annotation.PostResource;
|
|||
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
|
||||
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
|
||||
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
|
||||
import cn.stylefeng.roses.kernel.system.modular.user.pojo.request.SysUserRequest;
|
||||
import cn.stylefeng.roses.kernel.system.UserServiceApi;
|
||||
import cn.stylefeng.roses.kernel.system.modular.user.pojo.request.SysUserRequest;
|
||||
import cn.stylefeng.roses.kernel.system.modular.user.service.SysUserService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
@ -194,7 +194,7 @@ public class SysUserController {
|
|||
*/
|
||||
@GetResource(name = "系统用户_获取用户数据范围列表", path = "/sysUser/getUserDataScope")
|
||||
public ResponseData ownData(@Validated(SysUserRequest.detail.class) SysUserRequest sysUserRequest) {
|
||||
List<Long> userBindDataScope = userServiceApi.getUserBindDataScope(sysUserRequest.getId());
|
||||
List<Long> userBindDataScope = userServiceApi.getUserBindDataScope(sysUserRequest.getUserId());
|
||||
return new SuccessResponseData(userBindDataScope);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@ public class SysUserRequest extends BaseRequest {
|
|||
/**
|
||||
* 主键
|
||||
*/
|
||||
@NotNull(message = "id不能为空,请检查id参数", groups = {edit.class, delete.class, detail.class, start.class, stop.class, grantRole.class, grantData.class, updateInfo.class, updatePwd.class, resetPwd.class, changeStatus.class, updateAvatar.class})
|
||||
private Long id;
|
||||
@NotNull(message = "userId不能为空", groups = {edit.class, delete.class, detail.class, start.class, stop.class, grantRole.class, grantData.class, updateInfo.class, updatePwd.class, resetPwd.class, changeStatus.class, updateAvatar.class})
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 账号
|
||||
|
@ -62,8 +62,8 @@ public class SysUserRequest extends BaseRequest {
|
|||
/**
|
||||
* 姓名
|
||||
*/
|
||||
@NotBlank(message = "姓名不能为空,请检查name参数", groups = {add.class, edit.class})
|
||||
private String name;
|
||||
@NotBlank(message = "姓名不能为空", groups = {add.class, edit.class})
|
||||
private String realName;
|
||||
|
||||
/**
|
||||
* 头像
|
||||
|
|
|
@ -25,7 +25,7 @@ public class SysUserDataScopeServiceImpl extends ServiceImpl<SysUserDataScopeMap
|
|||
public void grantData(SysUserRequest sysUserRequest) {
|
||||
|
||||
// 获取用户id
|
||||
Long userId = sysUserRequest.getId();
|
||||
Long userId = sysUserRequest.getUserId();
|
||||
|
||||
// 删除该用户的数据范围集合,sys_user_data_scope表中
|
||||
LambdaQueryWrapper<SysUserDataScope> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package cn.stylefeng.roses.kernel.system.modular.user.service.impl;
|
||||
|
||||
import cn.stylefeng.roses.kernel.system.DataScopeApi;
|
||||
import cn.stylefeng.roses.kernel.system.RoleServiceApi;
|
||||
import cn.stylefeng.roses.kernel.system.modular.user.entity.SysUserRole;
|
||||
import cn.stylefeng.roses.kernel.system.modular.user.mapper.SysUserRoleMapper;
|
||||
import cn.stylefeng.roses.kernel.system.modular.user.pojo.request.SysUserRequest;
|
||||
import cn.stylefeng.roses.kernel.system.modular.user.service.SysUserRoleService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import cn.stylefeng.roses.kernel.system.DataScopeApi;
|
||||
import cn.stylefeng.roses.kernel.system.RoleServiceApi;
|
||||
import cn.stylefeng.roses.kernel.system.modular.user.service.SysUserRoleService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
@ -35,7 +35,7 @@ public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUs
|
|||
public void grantRole(SysUserRequest sysUserRequest) {
|
||||
|
||||
// 获取用户id
|
||||
Long userId = sysUserRequest.getId();
|
||||
Long userId = sysUserRequest.getUserId();
|
||||
|
||||
// 删除该用户的所有角色
|
||||
LambdaQueryWrapper<SysUserRole> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
|
|
@ -282,7 +282,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
|
||||
@Override
|
||||
public List<Long> getUserRoles(SysUserRequest sysUserRequest) {
|
||||
return this.getUserRoleIdList(sysUserRequest.getId());
|
||||
return this.getUserRoleIdList(sysUserRequest.getUserId());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -411,7 +411,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
* @date 2020/3/26 9:54
|
||||
*/
|
||||
private SysUser querySysUser(SysUserRequest sysUserRequest) {
|
||||
SysUser sysUser = this.getById(sysUserRequest.getId());
|
||||
SysUser sysUser = this.getById(sysUserRequest.getUserId());
|
||||
if (ObjectUtil.isNull(sysUser)) {
|
||||
throw new SystemModularException(SysUserExceptionEnum.USER_NOT_EXIST);
|
||||
}
|
||||
|
@ -434,8 +434,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||
}
|
||||
|
||||
// 组装用户姓名的查询条件
|
||||
if (ObjectUtil.isNotEmpty(sysUserRequest.getName())) {
|
||||
queryWrapper.eq(SysUser::getRealName, sysUserRequest.getName());
|
||||
if (ObjectUtil.isNotEmpty(sysUserRequest.getRealName())) {
|
||||
queryWrapper.eq(SysUser::getRealName, sysUserRequest.getRealName());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue