36 lines
1.1 KiB
Java
36 lines
1.1 KiB
Java
|
|||
|
|
|
||
|
|
package com.weather.config;
|
||
|
|
|
||
|
|
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||
|
|
import com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor;
|
||
|
|
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.Configuration;
|
||
|
|
|
||
|
|
/**
|
||
|
|
* mybatis-plus配置
|
||
|
|
*
|
||
|
|
* @author 123
|
||
|
|
*/
|
||
|
|
@Configuration
|
||
|
|
public class MybatisPlusConfig {
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 配置分页等
|
||
|
|
*/
|
||
|
|
@Bean
|
||
|
|
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||
|
|
MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
|
||
|
|
// 分页插件
|
||
|
|
mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor());
|
||
|
|
// 乐观锁
|
||
|
|
mybatisPlusInterceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
|
||
|
|
// 防止全表更新与删除
|
||
|
|
mybatisPlusInterceptor.addInnerInterceptor(new BlockAttackInnerInterceptor());
|
||
|
|
|
||
|
|
return mybatisPlusInterceptor;
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|