use of com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor in project lamp-job by zuihou.
the class BaseExecutorMybatisAutoConfiguration method getPaginationBeforeInnerInterceptor.
/**
* 数据权限插件
*
* @return 数据权限插件
*/
@Override
protected List<InnerInterceptor> getPaginationBeforeInnerInterceptor() {
List<InnerInterceptor> list = new ArrayList<>();
Boolean isDataScope = databaseProperties.getIsDataScope();
if (isDataScope) {
list.add(new DataScopeInnerInterceptor(userId -> SpringUtils.getBean(UserService.class).getDataScopeById(userId)));
}
return list;
}
use of com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor in project project by Ahaochan.
the class MyBatisPlusConfig method mybatisPlusInterceptor.
/**
* @see <a href="https://mp.baomidou.com/guide/interceptor.html">插件主体(必看!)(since 3.4.0)</a>
*/
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
List<InnerInterceptor> innerInterceptors = Arrays.asList(// new TenantLineInnerInterceptor(), new DynamicTableNameInnerInterceptor(),
new PaginationInnerInterceptor(), new OptimisticLockerInnerInterceptor(), // update 和 delete 必须要有 where
new BlockAttackInnerInterceptor());
mybatisPlusInterceptor.setInterceptors(innerInterceptors);
return mybatisPlusInterceptor;
}
Aggregations