Home Spring Boot使用PageHelper
Post
Cancel

Spring Boot使用PageHelper

  • 引入依赖

    1
    2
    3
    4
    5
    
      <dependency>
          <groupId>com.github.pagehelper</groupId>
          <artifactId>pagehelper</artifactId>
          <version>4.1.0</version>
      </dependency>
    
  • 在application.yml中做如下配置

    1
    2
    3
    4
    5
    6
    
      # 分页配置
      pagehelper:
          helper-dialect: mysql
          reasonable: true
          support-methods-arguments: true
          params: count=countSql
    
  • 在代码中使用

    1
    2
    3
    4
    
      PageHelper.startPage(pageNum, pageSize); // 表示从pageNum页开始,每页pageSize条数据
      List<Tools> list = toolsMapper.findAll();
      PageInfo<Tools> pageInfo = new PageInfo<Tools>(list);
      return ServerResponse.createBySuccess("查询成功",pageInfo);
    
This post is licensed under CC BY 4.0 by the author.

Python下载yaml模块报错

Maven使用阿里云镜像下载jar包失败