教师端增加验证老师账号

hehai
jiakun.lin 4 years ago
parent 18bbaf91cf
commit 3776011f28
  1. 6
      src/main/java/com/msdw/tms/controller/UserInfoController.java
  2. 2
      src/main/java/com/msdw/tms/dao/UserInfoDao.java
  3. 1
      src/main/java/com/msdw/tms/service/UserInfoService.java
  4. 8
      src/main/java/com/msdw/tms/service/impl/UserInfoServiceImpl.java
  5. 4
      src/main/resources/mapper/tms/UserInfoDao.xml

@ -182,6 +182,12 @@ public class UserInfoController implements UserInfoControllerApi {
UserInfoEntity userInfo = vo.getUserInfoEntity(); UserInfoEntity userInfo = vo.getUserInfoEntity();
Integer userId = userInfo.getUserId(); Integer userId = userInfo.getUserId();
String password = userInfo.getPassword(); String password = userInfo.getPassword();
//验证账号是否存在
int num = userInfoService.queryAccountExist(userInfo.getAccount());
if (num >= 1){
return R.error(500,"更新失败,账号不能重复");
}
String userPassword = userInfoService.queryPasword(userId); String userPassword = userInfoService.queryPasword(userId);
if (userPassword.equals(password)==true){ if (userPassword.equals(password)==true){
return R.error(400,"false,the password is the same!!!"); return R.error(400,"false,the password is the same!!!");

@ -66,4 +66,6 @@ public interface UserInfoDao extends BaseMapper<UserInfoEntity> {
List<String> queryStudentName(Integer userId); List<String> queryStudentName(Integer userId);
Integer getUserId(String token); Integer getUserId(String token);
Integer queryAccountExist(String account);
} }

@ -50,4 +50,5 @@ public interface UserInfoService extends IService<UserInfoEntity> {
R getUserId(String token); R getUserId(String token);
Integer queryAccountExist(String account);
} }

@ -227,4 +227,12 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoDao, UserInfoEntity
Integer userId = userInfoDao.getUserId(token); Integer userId = userInfoDao.getUserId(token);
return R.ok().put("userId", userId); return R.ok().put("userId", userId);
} }
@Override
public Integer queryAccountExist(String account) {
Integer num = userInfoDao.queryAccountExist(account);
return num;
}
} }

@ -291,4 +291,8 @@
SELECT userId FROM hr_user_info where token = #{token} and isdel = 0 SELECT userId FROM hr_user_info where token = #{token} and isdel = 0
</select> </select>
<select id="queryAccountExist" resultType="java.lang.Integer">
SELECT count(*) FROM hr_user_info where account = 223 and isdel = 0
</select>
</mapper> </mapper>
Loading…
Cancel
Save