From 8bd023b49fbdf2bc0677da8b7bbdce6c820f32f9 Mon Sep 17 00:00:00 2001 From: 疯狂的狮子li <15040126243@163.com> Date: 星期三, 02 十一月 2022 10:34:58 +0800 Subject: [PATCH] fix 修复 sqlserver 分页问题 --- ruoyi-framework/src/main/java/com/ruoyi/framework/config/SaTokenConfig.java | 28 +++++++++++----------------- 1 files changed, 11 insertions(+), 17 deletions(-) diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SaTokenConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SaTokenConfig.java index a07494b..a7c51fa 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SaTokenConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SaTokenConfig.java @@ -1,12 +1,12 @@ package com.ruoyi.framework.config; -import cn.dev33.satoken.interceptor.SaAnnotationInterceptor; -import cn.dev33.satoken.interceptor.SaRouteInterceptor; +import cn.dev33.satoken.interceptor.SaInterceptor; import cn.dev33.satoken.jwt.StpLogicJwtForSimple; import cn.dev33.satoken.router.SaRouter; import cn.dev33.satoken.stp.StpLogic; import cn.dev33.satoken.stp.StpUtil; -import com.ruoyi.common.helper.LoginHelper; +import com.ruoyi.common.utils.spring.SpringUtils; +import com.ruoyi.framework.config.properties.ExcludeUrlProperties; import com.ruoyi.framework.config.properties.SecurityProperties; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -14,9 +14,6 @@ import org.springframework.context.annotation.Configuration; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; /** * sa-token 閰嶇疆 @@ -36,13 +33,15 @@ @Override public void addInterceptors(InterceptorRegistry registry) { // 娉ㄥ唽璺敱鎷︽埅鍣紝鑷畾涔夐獙璇佽鍒� - registry.addInterceptor(new SaRouteInterceptor((request, response, handler) -> { + registry.addInterceptor(new SaInterceptor(handler -> { + // 鑷畾涔夋敞瑙� @Anonymous 鍖垮悕璁块棶閰嶇疆锛屽悗缁増鏈皢鍒犻櫎 + ExcludeUrlProperties excludeUrlProperties = SpringUtils.getBean(ExcludeUrlProperties.class); // 鐧诲綍楠岃瘉 -- 鎺掗櫎澶氫釜璺緞 SaRouter // 鑾峰彇鎵�鏈夌殑 .match("/**") - // 鎺掗櫎涓嬩笉闇�瑕佹嫤鎴殑 - .notMatch(securityProperties.getExcludes()) + // 鎺掗櫎涓嬩笉闇�瑕佹嫤鎴殑锛堟瘡娆″尮閰嶏級 + .notMatch(excludeUrlProperties.getExcludes()) // 瀵规湭鎺掗櫎鐨勮矾寰勮繘琛屾鏌� .check(() -> { // 妫�鏌ユ槸鍚︾櫥褰� 鏄惁鏈塼oken @@ -55,14 +54,9 @@ // } }); - }) { - @SuppressWarnings("all") - @Override - public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception { - LoginHelper.clearCache(); - } - }).addPathPatterns("/**"); - registry.addInterceptor(new SaAnnotationInterceptor()).addPathPatterns("/**"); + })).addPathPatterns("/**") + // 鎺掗櫎涓嶉渶瑕佹嫤鎴殑璺緞 + .excludePathPatterns(securityProperties.getExcludes()); } @Bean -- Gitblit v1.9.3