springboot:实现分页查询,以及翻页功能
生活随笔
收集整理的這篇文章主要介紹了
springboot:实现分页查询,以及翻页功能
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
在pom.xml中引入依賴
<!-- 分頁查詢插件 --><dependency><groupId>com.github.pagehelper</groupId><artifactId>pagehelper-spring-boot-starter</artifactId><version>1.2.12</version></dependency>controller層
service層
?
映射配置xml文件
?
訪問
?
?
?
?翻頁功能:?翻頁需要使用到PageInfo對象
?html如下:
<nav aria-label="Page navigation"><ul class="pagination"><li th:class="${pageInfo.prePage} == 0 ? 'disabled':'' "><!-- 上一頁--><a th:href="${pageInfo.prePage} == 0 ? 'javascript:void(0)':@{'/account/list?pageNum='+${pageInfo.prePage}}" aria-label="Previous"><span aria-hidden="true">«</span></a></li><li th:each="pageNum : ${pageInfo.navigatepageNums}"><a th:href="@{'/account/list?pageNum='+${pageNum}}">[[${pageNum}]]</a></li><li th:class="${pageInfo.nextPage} == 0 ? 'disabled':'' "><a th:href="${pageInfo.nextPage} == 0 ? 'javascript:void(0)':@{'/account/list?pageNum='+${pageInfo.nextPage}}" aria-label="Next"><span aria-hidden="true">»</span></a></li></ul> </nav>這樣,翻頁就可以使用了。
總結
以上是生活随笔為你收集整理的springboot:实现分页查询,以及翻页功能的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Macbook air 键盘标点符号怎么
- 下一篇: springboot:简单oa系统开发