Merge branch 'feature/board'

This commit is contained in:
kimyonghwa
2019-09-05 23:14:52 +09:00
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

@@ -43,7 +43,7 @@ public class BoardService {
// 게시판 이름으로 게시글 리스트 조회.
@Cacheable(value = CacheKey.POSTS, key = "#boardName", unless = "#result == null")
public List<Post> findPosts(String boardName) {
return postJpaRepo.findByBoard(findBoard(boardName));
return postJpaRepo.findByBoardOrderByPostIdDesc(findBoard(boardName));
}
// 게시글ID로 게시글 단건 조회. 없을경우 CResourceNotExistException 처리