引入分页插件一共有下面2种方式,推荐使用Maven方式,这种方式方便更新。
https://oss.sonatype.org/content/repositories/releases/com/github/pagehelper/pagehelper/
http://repo1.maven.org/maven2/com/github/pagehelper/pagehelper/
由于使用了sql解析工具,你还需要下载jsqlparser.jar(这个文件完全独立,不依赖其他):
http://repo1.maven.org/maven2/com/github/jsqlparser/jsqlparser/0.9.1/
在mybatis.xml文件中配置
这样子分页插件会自动在你的查询语句后面添加 order by addtime DESC limit ?,?
后面的两个问号表示从第几条数据开始、查几条数据
最后你在Action层中加入
后面放入的listcheck就是你service层返回的list集合
1. 引入Jar包
https://oss.sonatype.org/content/repositories/releases/com/github/pagehelper/pagehelper/
http://repo1.maven.org/maven2/com/github/pagehelper/pagehelper/
由于使用了sql解析工具,你还需要下载jsqlparser.jar(这个文件完全独立,不依赖其他):
http://repo1.maven.org/maven2/com/github/jsqlparser/jsqlparser/0.9.1/
http://Git.oschina.NET/free/Mybatis_PageHelper/attach_files
2.使用maven
添加如下依赖:
在mybatis.xml文件中配置
这样子分页插件会自动在你的查询语句后面添加 order by addtime DESC limit ?,?
后面的两个问号表示从第几条数据开始、查几条数据
最后你在Action层中加入
后面放入的listcheck就是你service层返回的list集合
这样PageInfo就会自动给你进行计算分页了。