Skip to content

Commit

Permalink
[fix] 프레스센터 및 게시판 조회 순서 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
MinchoGreenT committed Sep 17, 2023
1 parent 3107e1f commit 7547246
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.example.hicardipresscenter.global;

import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;

Expand All @@ -26,7 +27,8 @@ public static Query getQueryWithDate(Pageable pageable, String option, String cr
.limit(pageable.getPageSize());
}

return query;
// desc by id
return query.with(Sort.by(Sort.Direction.DESC, "_id"));
}

public static Query getQuery(Pageable pageable, String criteria, String keyword) {
Expand All @@ -46,7 +48,7 @@ public static Query getQuery(Pageable pageable, String criteria, String keyword)
.limit(pageable.getPageSize());
}

return query;
return query.with(Sort.by(Sort.Direction.DESC, "_id"));
}

public static Query getTotalQuery(String criteria, String keyword) {
Expand Down

0 comments on commit 7547246

Please sign in to comment.