diff --git a/src/main/java/EBus/EBusback/domain/mainpage/service/MainPageService.java b/src/main/java/EBus/EBusback/domain/mainpage/service/MainPageService.java index 092f09e..82cc5ae 100644 --- a/src/main/java/EBus/EBusback/domain/mainpage/service/MainPageService.java +++ b/src/main/java/EBus/EBusback/domain/mainpage/service/MainPageService.java @@ -49,7 +49,7 @@ public MainPageResDto getMainPage(){ } } - List allSuggestion = postRepository.findAllByIsSuggestionOrderByCreatedDate(true); + List allSuggestion = postRepository.findAllByIsSuggestionOrderByCreatedDateDesc(true); List suggestionList = new ArrayList<>(); if (!(allSuggestion.isEmpty())){ if (allSuggestion.size()<3){ @@ -64,7 +64,7 @@ public MainPageResDto getMainPage(){ } } - List allAppreciation = postRepository.findAllByIsSuggestionOrderByCreatedDate(false); + List allAppreciation = postRepository.findAllByIsSuggestionOrderByCreatedDateDesc(false); List appreciationList = new ArrayList<>(); if (!(allAppreciation.isEmpty())){ if(allAppreciation.size()<3){ diff --git a/src/main/java/EBus/EBusback/domain/post/repository/PostRepository.java b/src/main/java/EBus/EBusback/domain/post/repository/PostRepository.java index d33aaa5..db9a9cf 100644 --- a/src/main/java/EBus/EBusback/domain/post/repository/PostRepository.java +++ b/src/main/java/EBus/EBusback/domain/post/repository/PostRepository.java @@ -7,7 +7,5 @@ import EBus.EBusback.domain.post.entity.Post; public interface PostRepository extends JpaRepository { - - List findAllByIsSuggestion(Boolean isSuggestion); - List findAllByIsSuggestionOrderByCreatedDate(Boolean isSuggestion); + List findAllByIsSuggestionOrderByCreatedDateDesc(Boolean isSuggestion); } diff --git a/src/main/java/EBus/EBusback/domain/post/service/PostService.java b/src/main/java/EBus/EBusback/domain/post/service/PostService.java index 73aaf12..e806732 100644 --- a/src/main/java/EBus/EBusback/domain/post/service/PostService.java +++ b/src/main/java/EBus/EBusback/domain/post/service/PostService.java @@ -76,7 +76,7 @@ public PostMemberDto findPostMemberInfo(Post post, Member member) { // isSuggestion: true -> 건의해요 리스트 조회 // isSuggestion: false -> 고마워요 리스트 조회 public List findPostList(Boolean isSuggestion) { - List postList = postRepository.findAllByIsSuggestion(isSuggestion); + List postList = postRepository.findAllByIsSuggestionOrderByCreatedDateDesc(isSuggestion); return postList.stream() .map(post -> new PostOutlineResponseDto(post, heartService.getHeartCount(post))) .collect(Collectors.toList());