Created
May 29, 2013 04:12
-
-
Save keesun/5667933 to your computer and use it in GitHub Desktop.
Board - Post, 1대다 양방향관계에서 최신 게시물의 뷰 카운트가 10 이상인 게시판 조회하기
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public List<Board> getPopularBoards(){ | |
List<Board> allBoards = boardDao.getAll(); | |
List<Post> recentPosts = new ArrayList()<>; | |
for(Board b : allBoards) { | |
Post p = postDao.getRecentPostFrom(b); | |
recentPosts.add(p); | |
} | |
List<Board> result = new ArrayList()<>; | |
for(Post p : recentPosts) { | |
if(p.getViewCount() > 10) { | |
result.add(p.getBoard()); | |
} | |
} | |
return result; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
아니야.. 이거보다 더 좋은거.