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