修复用户被删除后拦截的bug
This commit is contained in:
parent
3e2dd74717
commit
638d5865dc
|
|
@ -10,6 +10,7 @@ import com.mdd.common.enums.HttpEnum;
|
||||||
import com.mdd.common.exception.LoginException;
|
import com.mdd.common.exception.LoginException;
|
||||||
import com.mdd.common.mapper.user.UserMapper;
|
import com.mdd.common.mapper.user.UserMapper;
|
||||||
import com.mdd.common.util.StringUtils;
|
import com.mdd.common.util.StringUtils;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.springframework.lang.NonNull;
|
import org.springframework.lang.NonNull;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
@ -123,7 +124,15 @@ public class LikeFrontInterceptor implements HandlerInterceptor {
|
||||||
Object id = StpUtil.getLoginId();
|
Object id = StpUtil.getLoginId();
|
||||||
if (StringUtils.isNotNull(id)) {
|
if (StringUtils.isNotNull(id)) {
|
||||||
Integer userId = Integer.parseInt(id.toString());
|
Integer userId = Integer.parseInt(id.toString());
|
||||||
LikeFrontThreadLocal.put("userId", userId);
|
User user = userMapper.selectOne(new QueryWrapper<User>()
|
||||||
|
.select("id,sn,username")
|
||||||
|
.eq("id", userId)
|
||||||
|
.eq("is_disable", 0)
|
||||||
|
.eq("is_delete", 0)
|
||||||
|
.last("limit 1"));
|
||||||
|
|
||||||
|
Integer uid = StringUtils.isNull(user) ? 0 : userId;
|
||||||
|
LikeFrontThreadLocal.put("userId", uid);
|
||||||
}
|
}
|
||||||
} catch (Exception ignored) {}
|
} catch (Exception ignored) {}
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue