You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.2 KiB
37 lines
1.2 KiB
package {{ package.Common }}.config;
|
|
|
|
//--- 固定引入 ---//
|
|
import com.baomidou.mybatisplus.annotation.DbType;
|
|
import com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer;
|
|
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
|
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
|
import org.mybatis.spring.annotation.MapperScan;
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Configuration;
|
|
//--- 固定引入 ---//
|
|
|
|
/**
|
|
* MybatisPlus 配置
|
|
*
|
|
* @Author: {{author}}
|
|
* @Date: {{date}}
|
|
* @Wechat: {{ wechat }}
|
|
*/
|
|
|
|
@Configuration
|
|
@MapperScan(basePackages = {"{{package.Mapper}}"})
|
|
public class MybatisPlusConfig {
|
|
@Bean
|
|
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
|
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
|
//向Mybatis过滤器链中添加分页拦截器
|
|
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
|
|
//还可以添加i他的拦截器
|
|
return interceptor;
|
|
}
|
|
|
|
@Bean
|
|
public ConfigurationCustomizer configurationCustomizer() {
|
|
return configuration -> configuration.setUseGeneratedShortKey(false);
|
|
}
|
|
}
|
|
|