优化用户修改
This commit is contained in:
parent
caf990dbff
commit
494235ffb5
|
@ -161,7 +161,7 @@ public class AuthServiceImpl implements AuthService {
|
|||
}
|
||||
|
||||
// 如果用户名修改了,检查是否有重复,有重复则返回null,否则修改
|
||||
if (!verify.getUsername().equals(user.getUsername())) {
|
||||
if (user.getUsername() != null && !verify.getUsername().equals(user.getUsername())) {
|
||||
var regedUser = getUserByName(user.getUsername());
|
||||
if (regedUser != null) {
|
||||
return R.fail(HttpStatus.USERNAME_CONFLICT.getCode(), HttpStatus.USERNAME_CONFLICT.getDesc());
|
||||
|
@ -171,7 +171,7 @@ public class AuthServiceImpl implements AuthService {
|
|||
}
|
||||
|
||||
// 如果邮箱修改了,检查是否有重复,有重复则返回null,否则修改
|
||||
if (!verify.getEmail().equals(user.getEmail())) {
|
||||
if (user.getEmail() != null && !verify.getEmail().equals(user.getEmail())) {
|
||||
var regedUser = mongoTemplate.findOne(new Query(Criteria.where("email").is(user.getEmail()).and(CommonConstant.STATUS).ne(0)), User.class);
|
||||
if (regedUser != null) {
|
||||
return R.fail(HttpStatus.USERNAME_CONFLICT.getCode(), HttpStatus.USERNAME_CONFLICT.getDesc());
|
||||
|
@ -181,7 +181,7 @@ public class AuthServiceImpl implements AuthService {
|
|||
}
|
||||
|
||||
// 如果手机号修改了,检查是否有重复,有重复则返回null,否则修改
|
||||
if (!verify.getPhone().equals(user.getPhone())) {
|
||||
if (user.getPhone() != null && !verify.getPhone().equals(user.getPhone())) {
|
||||
var regedUser = mongoTemplate.findOne(new Query(Criteria.where("phone").is(user.getPhone()).and(CommonConstant.STATUS).ne(0)), User.class);
|
||||
if (regedUser != null) {
|
||||
return R.fail(HttpStatus.USERNAME_CONFLICT.getCode(), HttpStatus.USERNAME_CONFLICT.getDesc());
|
||||
|
|
Loading…
Reference in New Issue