修复某些情况下ContextHolder的NPE异常 #225

pull/30/MERGE
YunaiV 2023-03-11 10:15:39 +08:00
parent 5f96b50bad
commit 4b0e64f817
1 changed files with 3 additions and 3 deletions

View File

@ -539,11 +539,11 @@ public class DataPermissionDatabaseInterceptor extends JsqlParserSupport impleme
/**
* {@link MappedStatement}
*/
private static final ThreadLocal<List<DataPermissionRule>> RULES = new TransmittableThreadLocal<>();
/**
private static final ThreadLocal<List<DataPermissionRule>> RULES = ThreadLocal.withInitial(Collections::emptyList); /**
*
* SQL
*/
private static final ThreadLocal<Boolean> REWRITE = new TransmittableThreadLocal<>();
private static final ThreadLocal<Boolean> REWRITE = ThreadLocal.withInitial(() -> Boolean.FALSE);
public static void init(List<DataPermissionRule> rules) {
RULES.set(rules);