欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

在无报错的情况下 PageHelper.startPage(start,5)分页无效问题

程序员文章站 2022-03-10 09:03:18
@[TOC](在无报错的情况下 PageHelper.startPage(start,10);分页无效问题)使用Springboot2.4.0版本原先加入的的依赖是: com.github.pagehelper

@[TOC](在无报错的情况下 PageHelper.startPage(start,10);分页无效问题)

使用Springboot2.4.0版本

原先加入的的依赖是:

<!-- https://mvnrepository.com/artifact/com.github.pagehelper/pagehelper -->
<dependency>
    <groupId>com.github.pagehelper</groupId>
    <artifactId>pagehelper</artifactId>
    <version>5.1.11</version>
</dependency>

Controller层:

//查询所有
    @RequestMapping("list")
    public String findALl(Model model, @RequestParam(value = "start",defaultValue = "1") int start) throws Exception{
        PageHelper.startPage(start,5);
        List<Category> all = categoryService.findAll();
        PageInfo<Category> info = new PageInfo<>(all);
        model.addAttribute("info" , info);
        return "list";
    }

可是不起作用在页面显示时,数据全部展示了出来:
在无报错的情况下 PageHelper.startPage(start,5)分页无效问题

查找资料了解到自从spring boot开始使用2.0x版本以上后,很多相应的依赖文件版本开始变化将依赖换成:

		<dependency>
            <groupId>com.github.pagehelper</groupId>
            <artifactId>pagehelper-spring-boot-starter</artifactId>
            <version>1.2.12</version>
        </dependency>

PageHelper.startPage(start,5)分页就起作用了:
在无报错的情况下 PageHelper.startPage(start,5)分页无效问题
在无报错的情况下 PageHelper.startPage(start,5)分页无效问题
在无报错的情况下 PageHelper.startPage(start,5)分页无效问题

本文地址:https://blog.csdn.net/weixin_44067333/article/details/109843543

相关标签: java