在客户端-服务器上的分页查询请求资源服务器,服务器资源查询结果并返回org.springframework.data.domain.Page接口。我不能在客户端服务器上使用它。我将其封装为一个实体对象,但是问题是条件查询的参数无法传递。
@Override
public Page<RoleEntity> findAllPage(int page, int pageSize) {
ExampleMatcher.GenericPropertyMatchers.startsWith());
return roleDao.findAll(PageRequest.of(page-1, pageSize,Sort.by(Sort.Order.desc("id"))));
}
客户端服务器分页
<nav aria-label="..." th:fragment="simplePage(jpaPageTool)">
<ul class="pagination">
<li class="page-item" th:classappend="${jpaPageTool.isFirstPage}?'disabled':''">
<a class="page-link" th:href="@{${#request.getRequestURI()}(page=${jpaPageTool.page-1})}" aria-label="Previous">
<span aria-hidden="true">«</span>
<span class="sr-only">Previous</span>
</a>
</li>
<div th:text="${#request.getQueryString()}"></div>
<th:block th:if="${jpaPageTool.totalPages < 10}">
<th:block th:each="pageNo : ${#numbers.sequence(1, jpaPageTool.totalPages)}">
<li class="page-item " th:classappend="${jpaPageTool.page == pageNo}?'active':''">
<a class="page-link" th:href="@{${#request.getRequestURI()}(page=${pageNo})}" th:text="${pageNo}"></a>
</li>
</th:block>
</th:block>
<li class="page-item" th:classappend="${!jpaPageTool.isLastPage}?'disabled':''">
<a class="page-link" th:href="@{${#request.getRequestURI()}(page=${jpaPageTool.page+1})}" aria-label="Next">
<span aria-hidden="true">»</span>
<span class="sr-only">Next</span>
</a>
</li>
</ul>
</nav>
org.springframework.boot:spring-boot-starter-data-jpa:2.1.2。发布 org.springframework.boot:spring-boot-starter-web:2.1.2.RELEASE org.springframework.cloud:spring-cloud-启动的oauth2:2.1.1.Rosease