githup open source java plugin pagination

maven

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

YML

# PageHelper分页插件
pagehelper: 
  helperDialect: mysql
  reasonable: true
  supportMethodsArguments: true
  params: count=countSql 

Simple to use and convenient. You can print sql see the specific SQL execution

List public <ComparisonVO> List (pageNum int, int the pageSize) throws Exception {
    // increasing method before being paged
  PageHelper.startPage (pageNum, the pageSize, null);
   List <ComparisonVO> List = masterMapper.listMasterData (TableInfo);
   / / paged basic information obtained in this manner, has a total number of pages, the total number of recorded
  new new PageInfo (List) .getTotal ()
   return List;
}

 

Guess you like

Origin www.cnblogs.com/baobaoxiaokeai/p/11243296.html