更新用户优化

hehai
chen 4 years ago
parent 8f7e968266
commit bde3f0d3b3
  1. 2
      src/main/java/com/msdw/tms/controller/UserInfoController.java
  2. 3
      src/main/java/com/msdw/tms/dao/UserInfoDao.java
  3. 3
      src/main/java/com/msdw/tms/service/UserInfoService.java
  4. 8
      src/main/java/com/msdw/tms/service/impl/UserInfoServiceImpl.java
  5. 2
      src/main/resources/mapper/tms/UserInfoDao.xml

@ -184,7 +184,7 @@ public class UserInfoController implements UserInfoControllerApi {
String password = userInfo.getPassword();
//验证账号是否存在
int num = userInfoService.queryAccountExist(userInfo.getAccount());
int num = userInfoService.queryAccountExist(userInfo.getAccount(),userInfo.getUserId());
if (num >= 1){
return R.error(500,"更新失败,账号不能重复");
}

@ -5,6 +5,7 @@ import com.msdw.tms.entity.StudentEntity;
import com.msdw.tms.entity.UserInfoEntity;
import com.msdw.tms.entity.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -67,5 +68,5 @@ public interface UserInfoDao extends BaseMapper<UserInfoEntity> {
Integer getUserId(String token);
Integer queryAccountExist(String account);
Integer queryAccountExist(@Param("account") String account,@Param("userId") Integer userId);
}

@ -9,7 +9,6 @@ import com.msdw.tms.entity.vo.StudentVo;
import com.msdw.tms.entity.vo.UserProsonalEntityVo;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public interface UserInfoService extends IService<UserInfoEntity> {
@ -50,5 +49,5 @@ public interface UserInfoService extends IService<UserInfoEntity> {
R getUserId(String token);
Integer queryAccountExist(String account);
Integer queryAccountExist(String account,Integer userId);
}

@ -11,11 +11,7 @@ import com.msdw.tms.dao.UserDao;
import com.msdw.tms.dao.UserInfoDao;
import com.msdw.tms.entity.StudentEntity;
import com.msdw.tms.entity.UserInfoEntity;
import com.msdw.tms.entity.response.CommonCode;
import com.msdw.tms.entity.response.ResponseResult;
import com.msdw.tms.entity.response.ResultCode;
import com.msdw.tms.entity.vo.CheckVo;
import com.msdw.tms.entity.vo.StaffVo;
import com.msdw.tms.entity.vo.StudentVo;
import com.msdw.tms.entity.vo.UserProsonalEntityVo;
import com.msdw.tms.service.UserInfoService;
@ -229,7 +225,7 @@ public class UserInfoServiceImpl extends ServiceImpl<UserInfoDao, UserInfoEntity
}
@Override
public Integer queryAccountExist(String account) {
return userInfoDao.queryAccountExist(account);
public Integer queryAccountExist(String account,Integer userId) {
return userInfoDao.queryAccountExist(account,userId);
}
}

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