From 494235ffb55c4bf30228b04852327953df2ae1c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=B3=E7=9A=AE=E5=B9=BC=E9=B8=9F?= <2960474346@qq.com> Date: Thu, 11 Apr 2024 19:56:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=94=A8=E6=88=B7=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../catchTheLetters/service/impl/AuthServiceImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/example/catchTheLetters/service/impl/AuthServiceImpl.java b/src/main/java/com/example/catchTheLetters/service/impl/AuthServiceImpl.java index 32ebb7a..aa8a149 100644 --- a/src/main/java/com/example/catchTheLetters/service/impl/AuthServiceImpl.java +++ b/src/main/java/com/example/catchTheLetters/service/impl/AuthServiceImpl.java @@ -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());