springboot整合PageHelper

1.pom文件中引入Pagehelper分页插件



    com.github.pagehelper
    pagehelper-spring-boot-starter
    1.2.5

 

2.配置分页插件

打开application.yml,添加如下几行配置信息

 

#分页插件

pagehelper:
  helper-dialect: mysql
  params: count=countSql
  reasonable: true
  support-methods-arguments: true

 

 

3. 分页样例

public ReturnBean> selectList(Map para) {
    Long count = getMapper().selectListCount(para);
    PageHelper.startPage(Integer.valueOf(para.get(SysConstant.PAGE).toString()),Integer.valueOf(para.get(SysConstant.LIMIT).toString()));
    List list = getMapper().selectList(para);
    PageInfo pageInfo = new PageInfo(list);
    return ReturnBean.list(pageInfo.getList(),count);
}

结束

 

转载于:https://www.cnblogs.com/wanlipenghtml/p/11348272.html

你可能感兴趣的:(springboot整合PageHelper)