Merge branch 'feature/board'
This commit is contained in:
@@ -7,5 +7,5 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface PostJpaRepo extends JpaRepository<Post, Long> {
|
public interface PostJpaRepo extends JpaRepository<Post, Long> {
|
||||||
List<Post> findByBoard(Board board);
|
List<Post> findByBoardOrderByPostIdDesc(Board board);
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,7 @@ public class BoardService {
|
|||||||
// 게시판 이름으로 게시글 리스트 조회.
|
// 게시판 이름으로 게시글 리스트 조회.
|
||||||
@Cacheable(value = CacheKey.POSTS, key = "#boardName", unless = "#result == null")
|
@Cacheable(value = CacheKey.POSTS, key = "#boardName", unless = "#result == null")
|
||||||
public List<Post> findPosts(String boardName) {
|
public List<Post> findPosts(String boardName) {
|
||||||
return postJpaRepo.findByBoard(findBoard(boardName));
|
return postJpaRepo.findByBoardOrderByPostIdDesc(findBoard(boardName));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 게시글ID로 게시글 단건 조회. 없을경우 CResourceNotExistException 처리
|
// 게시글ID로 게시글 단건 조회. 없을경우 CResourceNotExistException 처리
|
||||||
|
|||||||
Reference in New Issue
Block a user