Search in sources :

Example 26 with MybatisPlusInterceptor

use of com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor in project codingmore-learning by itwanger.

the class MyBatisConfig method mybatisPlusInterceptor.

// 最新版
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
    MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
    interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
    return interceptor;
}
Also used : MybatisPlusInterceptor(com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor) PaginationInnerInterceptor(com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor) Bean(org.springframework.context.annotation.Bean)

Example 27 with MybatisPlusInterceptor

use of com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor in project jeeagile by jeeagile.

the class AgileMybatisAutoConfiguration method mybatisPlusInterceptor.

@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
    MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
    mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor());
    return mybatisPlusInterceptor;
}
Also used : MybatisPlusInterceptor(com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor) PaginationInnerInterceptor(com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor) Bean(org.springframework.context.annotation.Bean)

Example 28 with MybatisPlusInterceptor

use of com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor in project springboot-templet-start by thedestiny.

the class MybatisPlusConfig method paginationInterceptor.

/**
 * 分页插件 PaginationInterceptor
 */
@Bean
public MybatisPlusInterceptor paginationInterceptor() {
    // PaginationInnerInterceptor paginationInterceptor = new PaginationInnerInterceptor();
    // return paginationInterceptor;
    MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
    // 设置请求的页面大于最大页后操作, true调回到首页,false 继续请求  默认false
    // paginationInterceptor.setOverflow(false);
    // 设置最大单页限制数量,默认 500 条,-1 不受限制
    // paginationInterceptor.setLimit(500);
    // 开启 count 的 join 优化,只针对部分 left join
    // 这是分页拦截器
    PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor();
    paginationInnerInterceptor.setOverflow(true);
    paginationInnerInterceptor.setMaxLimit(500L);
    mybatisPlusInterceptor.addInnerInterceptor(paginationInnerInterceptor);
    return mybatisPlusInterceptor;
}
Also used : MybatisPlusInterceptor(com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor) PaginationInnerInterceptor(com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor) Bean(org.springframework.context.annotation.Bean)

Example 29 with MybatisPlusInterceptor

use of com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor in project springboot-templet-start by thedestiny.

the class MybatisPlusConfig method paginationInterceptor.

@Bean
public MybatisPlusInterceptor paginationInterceptor() {
    // 设置请求的页面大于最大页后操作, true调回到首页,false 继续请求  默认false
    // paginationInterceptor.setOverflow(false);
    // 设置最大单页限制数量,默认 500 条,-1 不受限制
    // paginationInterceptor.setLimit(500);
    // 开启 count 的 join 优化,只针对部分 left join
    // 这是分页拦截器
    PaginationInnerInterceptor pagination = new PaginationInnerInterceptor();
    pagination.setOverflow(true);
    pagination.setMaxLimit(500L);
    MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
    interceptor.addInnerInterceptor(pagination);
    return interceptor;
}
Also used : MybatisPlusInterceptor(com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor) PaginationInnerInterceptor(com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor) Bean(org.springframework.context.annotation.Bean)

Example 30 with MybatisPlusInterceptor

use of com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor in project springboot-templet-start by thedestiny.

the class MybatisPlusConfig method paginationInterceptor.

@Bean
public MybatisPlusInterceptor paginationInterceptor() {
    MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
    // 设置请求的页面大于最大页后操作, true调回到首页,false 继续请求  默认false
    // paginationInterceptor.setOverflow(false);
    // 设置最大单页限制数量,默认 500 条,-1 不受限制
    // paginationInterceptor.setLimit(500);
    // 开启 count 的 join 优化,只针对部分 left join
    // 这是分页拦截器
    PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor();
    paginationInnerInterceptor.setOverflow(true);
    paginationInnerInterceptor.setMaxLimit(500L);
    mybatisPlusInterceptor.addInnerInterceptor(paginationInnerInterceptor);
    return mybatisPlusInterceptor;
}
Also used : MybatisPlusInterceptor(com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor) PaginationInnerInterceptor(com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor) Bean(org.springframework.context.annotation.Bean)

Aggregations

MybatisPlusInterceptor (com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor)113 Bean (org.springframework.context.annotation.Bean)110 PaginationInnerInterceptor (com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor)94 OptimisticLockerInnerInterceptor (com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor)18 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)15 BlockAttackInnerInterceptor (com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor)13 TenantLineInnerInterceptor (com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor)7 TenantLineHandler (com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler)4 InnerInterceptor (com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor)4 Order (org.springframework.core.annotation.Order)4 MybatisSqlSessionFactoryBean (com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean)3 Expression (net.sf.jsqlparser.expression.Expression)3 LongValue (net.sf.jsqlparser.expression.LongValue)3 MybatisConfiguration (com.baomidou.mybatisplus.core.MybatisConfiguration)2 IllegalSQLInnerInterceptor (com.baomidou.mybatisplus.extension.plugins.inner.IllegalSQLInnerInterceptor)2 StringValue (net.sf.jsqlparser.expression.StringValue)2 ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)2 ConditionalOnExpression (org.springframework.boot.autoconfigure.condition.ConditionalOnExpression)2 TenantLineHandler (com.albedo.java.plugins.database.handler.TenantLineHandler)1 SchemaInterceptor (com.albedo.java.plugins.database.interceptor.SchemaInterceptor)1