diff --git a/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/java/cn/iocoder/yudao/framework/datapermission/core/db/DataPermissionDatabaseInterceptor.java b/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/java/cn/iocoder/yudao/framework/datapermission/core/db/DataPermissionDatabaseInterceptor.java index 5fc4e55d04..6e5564865a 100644 --- a/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/java/cn/iocoder/yudao/framework/datapermission/core/db/DataPermissionDatabaseInterceptor.java +++ b/yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/java/cn/iocoder/yudao/framework/datapermission/core/db/DataPermissionDatabaseInterceptor.java @@ -539,11 +539,11 @@ public class DataPermissionDatabaseInterceptor extends JsqlParserSupport impleme /** * 该 {@link MappedStatement} 对应的规则 */ - private static final ThreadLocal> RULES = new TransmittableThreadLocal<>(); + private static final ThreadLocal> RULES = ThreadLocal.withInitial(Collections::emptyList); /** * SQL 是否进行重写 */ - private static final ThreadLocal REWRITE = new TransmittableThreadLocal<>(); + private static final ThreadLocal REWRITE = ThreadLocal.withInitial(() -> Boolean.FALSE); public static void init(List rules) { RULES.set(rules);