mybatis分页插件PageHelper简单应用
--添加依赖
<!-- 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());
最新文章
- 常用JavaScript触发事件
- 通过CAGradientLayer制作渐变色效果(转)
- c++中关于初始化型参列表的一些问题
- Android服务之Service(其一)
- Javascript调用ActiveX示例
- seafile修改
- Part 52 Attributes in C#
- Microsoft .NET Framework 3.5 for Windowns Server2012R2 GUI
- LM393,LM741可以用作电压跟随器吗?
- php随机抽奖实例分析
- 关于ognl.OgnlException: target is null for setProperty(null的解决方案
- [js高手之路]es6系列教程 - 解构详解
- minecraft初探
- Android 安全开发之 ZIP 文件目录遍历
- 减肥标准BMI指数
- 路由器DHCP服务及DHCP中继
- mysql 集群 数据同步
- iOS 获取设备的各种信息的方法
- 初始Flask
- 1015. [JSOI2008]星球大战【并查集】
热门文章
- error LNK2005: ";void * __cdecl operator new(unsigned int)"; (??2@YAPAXI@Z) already defined in LIBCMT
- 基本pipline用法
- JavaScript-数据类型和变量
- Java之创建线程的方式四:使用线程池
- vue项目 首页开发 part2
- awk中传参方式
- Dynamics CRM - 如何通过 C# Plugin 给 Contact的 主键(FullName)赋值
- Kattis dragonball1	Dragon Ball I(最短路)
- -bash: fultter: command not found
- Python—使用列表构造栈数据结构