Skip to content

Commit a51dce7

Browse files
committed
post 정렬 추가
1 parent 458de9d commit a51dce7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

‎src/main/java/com/rest/api/repo/board/PostJpaRepo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
import java.util.List;
88

99
public interface PostJpaRepo extends JpaRepository<Post, Long> {
10-
List<Post> findByBoard(Board board);
10+
List<Post> findByBoardOrderByPostIdDesc(Board board);
1111
}

‎src/main/java/com/rest/api/service/board/BoardService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public Board findBoard(String boardName) {
3333

3434
// 게시판 이름으로 게시물 리스트 조회.
3535
public List<Post> findPosts(String boardName) {
36-
return postJpaRepo.findByBoard(findBoard(boardName));
36+
return postJpaRepo.findByBoardOrderByPostIdDesc(findBoard(boardName));
3737
}
3838

3939
// 게시물ID로 게시물 단건 조회. 없을경우 CResourceNotExistException 처리

0 commit comments

Comments
 (0)
X