top.isopen.commons.springboot.config.MybatisPlusConfig Maven / Gradle / Ivy
package top.isopen.commons.springboot.config;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* MybatisPlus 配置类
*
* 用于注册 分页器 {@link MybatisPlusInterceptor}
*
* @author TimeChaser
* @version 1.0
* @since 2023/7/7 17:02
*/
@Configuration(proxyBeanMethods = false)
public class MybatisPlusConfig {
@Bean
@ConditionalOnMissingBean({MybatisPlusInterceptor.class})
public MybatisPlusInterceptor paginationInterceptor() {
MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
return mybatisPlusInterceptor;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy