Skip to content

Commit

Permalink
#461 [feat] change order strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
sohyundoh committed Aug 9, 2024
1 parent f0ae980 commit 3bd722e
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public interface WriterNameRepository extends JpaRepository<WriterName, Long> {

List<WriterName> findTop2ByMoimIdAndTotalCuriousCountGreaterThanOrderByTotalCuriousCountDesc(final Long moimId, final int totalCuriousCount);

Page<WriterName> findByMoimIdOrderByIdDesc(Long moimId, Pageable pageable);
Page<WriterName> findByMoimIdOrderById(Long moimId, Pageable pageable);

Optional<WriterName> findById(final Long id);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,6 @@ public List<WriterName> findTop2ByCuriousCount(final Long moimid) {


public Page<WriterName> findWriterNameByMoimIdOrderByLatest(final Long moimId, final PageRequest pageRequest) {
return writerNameRepository.findByMoimIdOrderByIdDesc(moimId, pageRequest);
return writerNameRepository.findByMoimIdOrderById(moimId, pageRequest);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public MoimWriterNameListGetResponse getWriterNameInfoList(
final int page
) {
final Long moimId = moim.getId();
PageRequest pageRequest = PageRequest.of(page - 1, WRITERNAME_PER_PAGE_SIZE, Sort.by(Sort.Direction.DESC, "id"));
PageRequest pageRequest = PageRequest.of(page - 1, WRITERNAME_PER_PAGE_SIZE);
Page<WriterName> writerNamePage = writerNameRetriever.findWriterNameByMoimIdOrderByLatest(moimId, pageRequest);
List<WriterNameInfoResponse> infoResponses = writerNamePage.getContent()
.stream()
Expand Down

0 comments on commit 3bd722e

Please sign in to comment.