use of com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor in project mybatis-plus-samples by baomidou.
the class MybatisPlusConfig method mybatisPlusInterceptor.
/**
* 分页插件
*/
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
return interceptor;
}
use of com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor in project mybatis-plus-samples by baomidou.
the class MpJsonConfig method mybatisPlusInterceptor.
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
return interceptor;
}
use of com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor in project mybatis-plus-samples by baomidou.
the class DbConfigurations method mybatisPlusInterceptor.
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor());
return mybatisPlusInterceptor;
}
use of com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor in project muses by acgist.
the class MyBatisAutoConfiguration method mybatisPlusInterceptor.
@Bean
@ConditionalOnMissingBean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
final MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
return interceptor;
}
use of com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor in project sakura-boot by yanjingfan.
the class MybatisPlusConfig method tenantPaginationInterceptor.
/**
* 多租户分页
* @return
*/
@ConditionalOnProperty(prefix = "tenant", name = "column")
@Bean
public MybatisPlusInterceptor tenantPaginationInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
TenantLineInnerInterceptor tenantInnerInterceptor = new TenantLineInnerInterceptor();
tenantInnerInterceptor.setTenantLineHandler(new TenantLineHandler() {
@Override
public Expression getTenantId() {
// 可将租户id和租户字段放置在请求头中
try {
String tenantId = request.getHeader("tenantId");
if (tenantId == null || "".equals(tenantId.trim())) {
return new LongValue(-1);
}
return new LongValue(Long.parseLong(tenantId));
} catch (Exception e) {
return new LongValue(-1);
}
}
@Override
public String getTenantIdColumn() {
return environment.getProperty("tenant.column");
// 可将租户id和租户字段放置在请求头中
// return request.getHeader("tenantColumn");
}
@Override
public boolean ignoreTable(String tableName) {
// 忽略uid-generator模块相关表
if ("worker_node".equalsIgnoreCase(tableName)) {
return true;
}
return false;
}
});
interceptor.addInnerInterceptor(tenantInnerInterceptor);
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
return interceptor;
}
Aggregations