Mysql分页插件的使用

 自定义一个分页类

total为总记录数, result为当前分页的结果


public class PageResult <T>{
	
	private Long total;
	
	private List<T> result;

在mybatis配置文件中加入分页插件

<!-- 分页插件 -->
	<plugins>
		<!-- com.github.pagehelper 为 PageHelper 类所在包名 -->
		<plugin interceptor="com.github.pagehelper.PageHelper">
			<!-- 设置数据库类型 Oracle,Mysql,MariaDB,SQLite,Hsqldb,PostgreSQL 六种数据库-->
			<property name="dialect" value="mysql"/>
		</plugin>
	</plugins>

service层加以下逻辑

页面


工程代码

链接: https://pan.baidu.com/s/1OKAJ6ftuphcLo3zSEcjgwA 提取码: 99ps


猜你喜欢

转载自blog.csdn.net/weixin_42195284/article/details/84073649