Search in sources :

Example 86 with MybatisPlusInterceptor

use of com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor in project pig by pig-mesh.

the class MybatisAutoConfiguration method mybatisPlusInterceptor.

/**
 * 分页插件, 对于单一数据库类型来说,都建议配置该值,避免每次分页都去抓取数据库类型
 */
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
    MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
    interceptor.addInnerInterceptor(new PigPaginationInnerInterceptor());
    return interceptor;
}
Also used : PigPaginationInnerInterceptor(com.pig4cloud.pig.common.mybatis.plugins.PigPaginationInnerInterceptor) MybatisPlusInterceptor(com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor) Bean(org.springframework.context.annotation.Bean)

Example 87 with MybatisPlusInterceptor

use of com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor in project Ant-Live by PinTeh.

the class MybatisPlusConfig 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 88 with MybatisPlusInterceptor

use of com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor in project waynboot-mall by wayn111.

the class MybatisPlusConfig method mybatisPlusInterceptor.

// 最新版
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
    MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
    interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.H2));
    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 89 with MybatisPlusInterceptor

use of com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor in project waynboot-mall by wayn111.

the class MybatisPlusConfig 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 90 with MybatisPlusInterceptor

use of com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor 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;
}
Also used : BlockAttackInnerInterceptor(com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor) MybatisPlusInterceptor(com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor) PaginationInnerInterceptor(com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor) OptimisticLockerInnerInterceptor(com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor) BlockAttackInnerInterceptor(com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor) InnerInterceptor(com.baomidou.mybatisplus.extension.plugins.inner.InnerInterceptor) PaginationInnerInterceptor(com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor) OptimisticLockerInnerInterceptor(com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor) 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