添加
//判断登录名的唯一性 QueryWrapper<User> query = new QueryWrapper<>(); query.lambda().eq(User::getLoginName,user.getLoginName()); User one = userService.getOne(query); if(one != null && one.getUserId() != user.getUserId()){ return ResultUtils.error("用户名已经被占用!",500); }
修改
//判断登录名的唯一性 QueryWrapper<User> query = new QueryWrapper<>(); query.lambda().eq(User::getLoginName,user.getLoginName()); User one = userService.getOne(query); if(one != null && one.getUserId() != user.getUserId()){ return ResultUtils.error("用户名已经被占用!",500); }
标签:QueryWrapper,校验,getUserId,getLoginName,plus,User,mybatis,query,user From: https://www.cnblogs.com/hnzj/p/17438538.html