Search in sources :

Example 11 with MybatisPlusInterceptor

use of com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor in project hippo4j by longtai-cn.

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 12 with MybatisPlusInterceptor

use of com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor in project demo-SpringBoot by Max-Qiu.

the class MybatisPlusConfig method paginationInterceptor.

@Bean
public MybatisPlusInterceptor paginationInterceptor() {
    MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
    // 添加分页插件
    interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
    // 添加 攻击 SQL 阻断解析器,防止全表更新与删除
    interceptor.addInnerInterceptor(new BlockAttackInnerInterceptor());
    // 添加 乐观锁 插件
    interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
    return interceptor;
}
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) Bean(org.springframework.context.annotation.Bean)

Example 13 with MybatisPlusInterceptor

use of com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor in project demo-SpringBoot by Max-Qiu.

the class MybatisPlusConfig method mybatisPlusInterceptor.

/**
 * 插件配置
 */
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
    MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
    // 添加分页插件
    PaginationInnerInterceptor paginationInnerInterceptor = new PaginationInnerInterceptor();
    // 设置无数据自动返回首页
    paginationInnerInterceptor.setOverflow(true);
    interceptor.addInnerInterceptor(paginationInnerInterceptor);
    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 14 with MybatisPlusInterceptor

use of com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor in project muscle-and-fitness-server by johnnymillergh.

the class MyBatisPlusConfiguration method mybatisPlusInterceptor.

/**
 * Mybatis plus interceptor mybatis plus interceptor.
 *
 * @param paginationInnerInterceptor  the pagination inner interceptor
 * @param blockAttackInnerInterceptor the block attack inner interceptor
 * @return the mybatis plus interceptor
 * @see <a href='https://baomidou.com/guide/interceptor.html'>MybatisPlusInterceptor</a>
 */
@Bean
@Order(1)
public Interceptor mybatisPlusInterceptor(PaginationInnerInterceptor paginationInnerInterceptor, BlockAttackInnerInterceptor blockAttackInnerInterceptor) {
    log.warn("Initial bean: '{}'", MybatisPlusInterceptor.class.getSimpleName());
    val mybatisPlusInterceptor = new MybatisPlusInterceptor();
    mybatisPlusInterceptor.addInnerInterceptor(paginationInnerInterceptor);
    mybatisPlusInterceptor.addInnerInterceptor(blockAttackInnerInterceptor);
    return mybatisPlusInterceptor;
}
Also used : lombok.val(lombok.val) MybatisPlusInterceptor(com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor) Order(org.springframework.core.annotation.Order) Bean(org.springframework.context.annotation.Bean)

Example 15 with MybatisPlusInterceptor

use of com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor in project weather-push by yangh124.

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)

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