Skip to content

Commit

Permalink
更新插件忽略代码.
Browse files Browse the repository at this point in the history
  • Loading branch information
nieqiurong committed Dec 24, 2024
1 parent f7dcbe3 commit 2073e7c
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/content/docs/plugins/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,15 @@ public class MybatisPlusConfig {
`3.5.3` 版本开始,你可以手动设置拦截器的忽略执行策略,这比注解更加灵活。但是,你需要手动关闭调用方法。

```java
// 设置忽略租户插件
InterceptorIgnoreHelper.handle(IgnoreStrategy.builder().tenantLine(true).build());

// 执行逻辑 ..

// 关闭忽略策略
InterceptorIgnoreHelper.clearIgnoreStrategy();
// 请尽量使用 try finally 的方式来保证能正确得到关闭
try {
// 设置忽略租户插件
InterceptorIgnoreHelper.handle(IgnoreStrategy.builder().tenantLine(true).build());
// 执行逻辑 ..
} finally {
// 关闭忽略策略
InterceptorIgnoreHelper.clearIgnoreStrategy();
}
```

## 本地缓存 SQL 解析
Expand Down

0 comments on commit 2073e7c

Please sign in to comment.