|
|
|
@ -1,8 +1,9 @@
|
|
|
|
package com.ruoyi.framework.config;
|
|
|
|
package com.ruoyi.framework.config;
|
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.inner.IllegalSQLInnerInterceptor;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.SqlExplainInterceptor;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
|
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|
|
|
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|
|
|
@ -15,24 +16,33 @@ public class MybatisPlusConfig {
|
|
|
|
* 分页插件,自动识别数据库类型
|
|
|
|
* 分页插件,自动识别数据库类型
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
|
public PaginationInterceptor paginationInterceptor() {
|
|
|
|
public PaginationInnerInterceptor paginationInnerInterceptor() {
|
|
|
|
return new PaginationInterceptor();
|
|
|
|
return new PaginationInnerInterceptor();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 乐观锁插件
|
|
|
|
* 乐观锁插件
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
|
public OptimisticLockerInterceptor optimisticLockerInterceptor() {
|
|
|
|
public OptimisticLockerInnerInterceptor optimisticLockerInnerInterceptor() {
|
|
|
|
return new OptimisticLockerInterceptor();
|
|
|
|
return new OptimisticLockerInnerInterceptor();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 如果是对全表的删除或更新操作,就会终止该操作
|
|
|
|
* 如果是对全表的删除或更新操作,就会终止该操作
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
|
public SqlExplainInterceptor sqlExplainInterceptor() {
|
|
|
|
public BlockAttackInnerInterceptor blockAttackInnerInterceptor() {
|
|
|
|
return new SqlExplainInterceptor();
|
|
|
|
return new BlockAttackInnerInterceptor();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* sql性能规范插件(垃圾SQL拦截)
|
|
|
|
|
|
|
|
* 如有需要可以启用
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
// @Bean
|
|
|
|
|
|
|
|
// public IllegalSQLInnerInterceptor illegalSQLInnerInterceptor() {
|
|
|
|
|
|
|
|
// return new IllegalSQLInnerInterceptor();
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|