分页工具之【PageHelper】

1.PageHelper技术

依赖

    <!-- PageHelper -->
        <dependency>
          <groupId>com.github.pagehelper</groupId>
          <artifactId>pagehelper</artifactId>
          <version>5.1.2</version>
      </dependency>
<dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper-spring-boot-autoconfigure</artifactId> <version>1.2.3</version> </dependency>
<dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper-spring-boot-starter</artifactId> <version>1.2.3</version> </dependency>

 

引用的包

import com.github.pagehelper.PageHelper;

案例

public void test()
    {
        // 设置分页(第一页,100条)
        PageHelper.startPage(1, 100);
        // select * from product where id > 12274  数据库中有5000条
        List<Integer> productIdList = productManageMapper.getProductList(12274);
        // productIdList.size() = 100
        System.out.println("productIdList.size() = " + productIdList.size());
    }

 

posted @ 2023-08-17 10:45  骚哥  阅读(73)  评论(0编辑  收藏  举报