post 정렬 추가

This commit is contained in:
kimyonghwa
2019-09-05 23:13:20 +09:00
parent 458de9d927
commit a51dce74ad
2 changed files with 2 additions and 2 deletions

View File

@@ -7,5 +7,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
import java.util.List;
public interface PostJpaRepo extends JpaRepository<Post, Long> {
List<Post> findByBoard(Board board);
List<Post> findByBoardOrderByPostIdDesc(Board board);
}

View File

@@ -33,7 +33,7 @@ public class BoardService {
// 게시판 이름으로 게시물 리스트 조회.
public List<Post> findPosts(String boardName) {
return postJpaRepo.findByBoard(findBoard(boardName));
return postJpaRepo.findByBoardOrderByPostIdDesc(findBoard(boardName));
}
// 게시물ID로 게시물 단건 조회. 없을경우 CResourceNotExistException 처리