Skip to content

Commit

Permalink
MyBatisPlusConfig 优化
Browse files Browse the repository at this point in the history
  • Loading branch information
liwenbin committed Jan 6, 2021
1 parent 743a05b commit ac20ed6
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.company.project.common.config;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

Expand All @@ -14,10 +17,13 @@
@Configuration
public class MyBatisPlusConfig {
/**
* 配置mybatis-plus 分页查件
* 配置mybatis-plus 拦截器
*/
@Bean
public PaginationInterceptor paginationInterceptor() {
return new PaginationInterceptor();
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
//添加分页拦截器
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
return interceptor;
}
}

0 comments on commit ac20ed6

Please sign in to comment.