自定义分页
2018-05-14 本文已影响0人
街角的幸福i
PageRequest pageRequest =new PageRequest(paginationRequest.getCurrentPage()-1, paginationRequest.getPageSize());
Listaccs1= accs.subList((paginationRequest.getCurrentPage()-1)*paginationRequest.getPageSize(),paginationRequest.getCurrentPage()*paginationRequest.getPageSize());
Page page =new PageImpl(accs1, pageRequest, accs.size());
PaginationResponse pageResponse =new PaginationResponse(page, Accounts.class);
pageResponse.setContent(page.getContent());
pageResponse.setCurrentPage(pageResponse.getCurrentPage() +1);
return pageResponse;