Mybatis pagehelper 分页插件的使用
一,开始
项目地址:https://github.com/pagehelper/Mybatis-PageHelper
1.导入
<!--Mybatis 分页插件 (推荐导入插件当前最新版本)--> <dependency> <groupId>com.github.pagehelper</groupId> <artifactId>pagehelper-spring-boot-starter</artifactId> <version>1.4.1</version> </dependency>
2.使用
//一般使用在service层中 //页码,每页显示数量 PageHelper.startPage(pageNum,pageSize); //查询语句 查询全部 List<TagBean> list=TagService.getTagAll(); //返回pageinfo PagInfo<TagBean> pageinfo=PageInfo<TagBean>(list);
二,进阶
参考文章:https://www.cnblogs.com/mengw/p/11673637.html
posted on 2023-03-26 22:29 Mikasa-Ackerman 阅读(12) 评论(0) 编辑 收藏 举报