diff --git a/src/main/java/floud/demo/dto/PageInfo.java b/src/main/java/floud/demo/dto/PageInfo.java index 6ce067f..8ca9ec7 100644 --- a/src/main/java/floud/demo/dto/PageInfo.java +++ b/src/main/java/floud/demo/dto/PageInfo.java @@ -9,5 +9,6 @@ public class PageInfo { private Integer nowPage; private Integer totalPages; private Long totalElements; + private Boolean previous; private Boolean last; } diff --git a/src/main/java/floud/demo/service/CommunityService.java b/src/main/java/floud/demo/service/CommunityService.java index 8144f53..d3e7f2d 100644 --- a/src/main/java/floud/demo/service/CommunityService.java +++ b/src/main/java/floud/demo/service/CommunityService.java @@ -126,12 +126,13 @@ private List setPostList(Page communityPage){ .toList(); } - private PageInfo setPageInfo(Page postPage){ + private PageInfo setPageInfo(Page communityPage){ return PageInfo.builder() - .last(!postPage.hasNext()) - .nowPage(postPage.getNumber()) - .totalPages(postPage.getTotalPages()) - .totalElements(postPage.getTotalElements()) + .last(!communityPage.hasNext()) + .previous(communityPage.hasPrevious()) + .nowPage(communityPage.getNumber()) + .totalPages(communityPage.getTotalPages()) + .totalElements(communityPage.getTotalElements()) .build(); } diff --git a/src/main/java/floud/demo/service/FriendshipService.java b/src/main/java/floud/demo/service/FriendshipService.java index 9cbd021..cb131ef 100644 --- a/src/main/java/floud/demo/service/FriendshipService.java +++ b/src/main/java/floud/demo/service/FriendshipService.java @@ -216,12 +216,13 @@ public List findFriendInfo(Users me, LocalDate date, Page postPage){ + private PageInfo setPageInfo(Page friendshipPage){ return PageInfo.builder() - .last(!postPage.hasNext()) - .nowPage(postPage.getNumber()) - .totalPages(postPage.getTotalPages()) - .totalElements(postPage.getTotalElements()) + .last(!friendshipPage.hasNext()) + .previous(friendshipPage.hasPrevious()) + .nowPage(friendshipPage.getNumber()) + .totalPages(friendshipPage.getTotalPages()) + .totalElements(friendshipPage.getTotalElements()) .build(); } } diff --git a/src/main/java/floud/demo/service/MyPageService.java b/src/main/java/floud/demo/service/MyPageService.java index 88e857c..4f7fae4 100644 --- a/src/main/java/floud/demo/service/MyPageService.java +++ b/src/main/java/floud/demo/service/MyPageService.java @@ -219,7 +219,8 @@ private Users getFriend(Friendship friendship, Users me) { private PageInfo setPageInfo(Page postPage){ return PageInfo.builder() .last(!postPage.hasNext()) - .nowPage(postPage.getNumber()) + .previous(postPage.hasPrevious()) + .nowPage(postPage.getNumber()+1) .totalPages(postPage.getTotalPages()) .totalElements(postPage.getTotalElements()) .build();