From 3776011f2863d073ead42e3f4ec4c1f40ef4da8e Mon Sep 17 00:00:00 2001 From: "jiakun.lin" Date: Fri, 26 Mar 2021 17:03:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=99=E5=B8=88=E7=AB=AF=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E8=80=81=E5=B8=88=E8=B4=A6=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/msdw/tms/controller/UserInfoController.java | 6 ++++++ src/main/java/com/msdw/tms/dao/UserInfoDao.java | 2 ++ src/main/java/com/msdw/tms/service/UserInfoService.java | 1 + .../com/msdw/tms/service/impl/UserInfoServiceImpl.java | 8 ++++++++ src/main/resources/mapper/tms/UserInfoDao.xml | 4 ++++ 5 files changed, 21 insertions(+) diff --git a/src/main/java/com/msdw/tms/controller/UserInfoController.java b/src/main/java/com/msdw/tms/controller/UserInfoController.java index 3e1578d..1ea72ce 100644 --- a/src/main/java/com/msdw/tms/controller/UserInfoController.java +++ b/src/main/java/com/msdw/tms/controller/UserInfoController.java @@ -182,6 +182,12 @@ public class UserInfoController implements UserInfoControllerApi { UserInfoEntity userInfo = vo.getUserInfoEntity(); Integer userId = userInfo.getUserId(); String password = userInfo.getPassword(); + + //验证账号是否存在 + int num = userInfoService.queryAccountExist(userInfo.getAccount()); + if (num >= 1){ + return R.error(500,"更新失败,账号不能重复"); + } String userPassword = userInfoService.queryPasword(userId); if (userPassword.equals(password)==true){ return R.error(400,"false,the password is the same!!!"); diff --git a/src/main/java/com/msdw/tms/dao/UserInfoDao.java b/src/main/java/com/msdw/tms/dao/UserInfoDao.java index b1a3cfc..ccdb1fc 100644 --- a/src/main/java/com/msdw/tms/dao/UserInfoDao.java +++ b/src/main/java/com/msdw/tms/dao/UserInfoDao.java @@ -66,4 +66,6 @@ public interface UserInfoDao extends BaseMapper { List queryStudentName(Integer userId); Integer getUserId(String token); + + Integer queryAccountExist(String account); } diff --git a/src/main/java/com/msdw/tms/service/UserInfoService.java b/src/main/java/com/msdw/tms/service/UserInfoService.java index 2948e42..59b44e0 100644 --- a/src/main/java/com/msdw/tms/service/UserInfoService.java +++ b/src/main/java/com/msdw/tms/service/UserInfoService.java @@ -50,4 +50,5 @@ public interface UserInfoService extends IService { R getUserId(String token); + Integer queryAccountExist(String account); } diff --git a/src/main/java/com/msdw/tms/service/impl/UserInfoServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/UserInfoServiceImpl.java index a852738..17459cc 100644 --- a/src/main/java/com/msdw/tms/service/impl/UserInfoServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/UserInfoServiceImpl.java @@ -227,4 +227,12 @@ public class UserInfoServiceImpl extends ServiceImpl + + \ No newline at end of file