mybatisplus 分页(selectPage不起作用方法)

注意:page 包都是mybatisplus的

配置类:
@MapperScan指向mapper包所在的地方

@Configuration
@MapperScan("com.qms.report.mapper")
public class MybatisPlusConfig {
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
        return interceptor;
    }
}

代码:

// 分页 当前页和每页大小
IPage<TemplateItemInfo> page = new Page<>(CurrentPage, PageSize);
//  new QueryWrapper.eq 起到筛选作用,可根据自己情况处理
IPage<TemplateItemInfo> templateItemInfoIPage = templateIteamInfoMapper.selectPage(page, new QueryWrapper<TemplateItemInfo>().eq("qc_template_id", templateId));
// 分页后的结果
List<TemplateItemInfo> temRecords = templateItemInfoIPage.getRecords();

posted @   Retired-lad  阅读(830)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
点击右上角即可分享
微信分享提示