--添加依赖

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

<!--boot框架可引入该依赖 https://mvnrepository.com/artifact/com.github.pagehelper/pagehelper-spring-boot-starter -->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.10</version>
</dependency>

--springboot配置(.yml)

#pagehelper
pagehelper:
    helperDialect: mysql
    #设置超过最大页数不再返回数据
    reasonable: false
    supportMethodsArguments: true
    params: count=countSql
    returnPageInfo: check

--简单使用(对于线程安全问题可以参考官网,注意对于大数据量,会用性能瓶颈)

int pageNum = Integer.parseInt(request.getParameter("pageNum"));
int pageSize = Integer.parseInt(request.getParameter("pageSize"));
PageHelper.startPage(pageNum,pageSize);
List<Map<String,Object>> list = getMarkersiteListNew(paramMap);
PageInfo<Map<String,Object>> pageInfo = new PageInfo<>(list);
Map<String,Object> listMap = new HashMap<>();
listMap.put("list",list);
listMap.put("pageNum",pageNum);
listMap.put("pageSize",pageSize/*list.size()*/);
listMap.put("total",pageInfo.getTotal());

最新文章

  1. 常用JavaScript触发事件
  2. 通过CAGradientLayer制作渐变色效果(转)
  3. c++中关于初始化型参列表的一些问题
  4. Android服务之Service(其一)
  5. Javascript调用ActiveX示例
  6. seafile修改
  7. Part 52 Attributes in C#
  8. Microsoft .NET Framework 3.5 for Windowns Server2012R2 GUI
  9. LM393,LM741可以用作电压跟随器吗?
  10. php随机抽奖实例分析
  11. 关于ognl.OgnlException: target is null for setProperty(null的解决方案
  12. [js高手之路]es6系列教程 - 解构详解
  13. minecraft初探
  14. Android 安全开发之 ZIP 文件目录遍历
  15. 减肥标准BMI指数
  16. 路由器DHCP服务及DHCP中继
  17. mysql 集群 数据同步
  18. iOS 获取设备的各种信息的方法
  19. 初始Flask
  20. 1015. [JSOI2008]星球大战【并查集】

热门文章

  1. error LNK2005: &quot;void * __cdecl operator new(unsigned int)&quot; (??2@YAPAXI@Z) already defined in LIBCMT
  2. 基本pipline用法
  3. JavaScript-数据类型和变量
  4. Java之创建线程的方式四:使用线程池
  5. vue项目 首页开发 part2
  6. awk中传参方式
  7. Dynamics CRM - 如何通过 C# Plugin 给 Contact的 主键(FullName)赋值
  8. Kattis dragonball1 Dragon Ball I(最短路)
  9. -bash: fultter: command not found
  10. Python—使用列表构造栈数据结构