首页 > 其他分享 >Mybatis-plus Page<>分页失效,records返回全部

Mybatis-plus Page<>分页失效,records返回全部

时间:2022-09-02 13:44:53浏览次数:46  
标签:mybatisplus plugins records baomidou import Mybatis plus com annotation

 

问题:分页失效

 

 

 

 

page  是传了的,但是还是返回了全部数据。

 

这里需要加一个config 文件

 

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.pagination.optimize.JsqlParserCountOptimize;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@EnableTransactionManagement
@Configuration
@MapperScan("com.acxiom.crm4.api.ck.domain.dao")
public class MybatisPlusConfig {
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor(){
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
        return interceptor;
    }
}

 

 

 

标签:mybatisplus,plugins,records,baomidou,import,Mybatis,plus,com,annotation
From: https://www.cnblogs.com/zq1003/p/16649551.html

相关文章