fix commentlist top5-> top2

main
wangqing 8 months ago
parent ec8a8c4803
commit 9ce74e850c

@ -13,6 +13,7 @@ public interface CommentDao extends MongoRepository<Comment,String> {
public Page<Comment> findByJournalId(String journalId, Pageable pageable);
public List<Comment> findTop5ByJournalIdOrderByThumbupCountDesc(String journalId);
public List<Comment> findTop2ByJournalIdOrderByThumbupCountDesc(String journalId);
public List<Comment> findByJournalId(String journalId);

@ -28,7 +28,7 @@ public class CommentMapper {
*/
CommentDTO commentDTO=new CommentDTO();
List<Comment> commentList =commentDao.findTop5ByJournalIdOrderByThumbupCountDesc(journalId);
List<Comment> commentList =commentDao.findTop2ByJournalIdOrderByThumbupCountDesc(journalId);
commentDTO.setCommentList(commentList);
/**
*
@ -62,7 +62,7 @@ public class CommentMapper {
}
public static List<Comment> getList(String journalId,CommentDao commentDao,UserClient userClient){
List<Comment> commentList =commentDao.findTop5ByJournalIdOrderByThumbupCountDesc(journalId);
List<Comment> commentList =commentDao.findTop2ByJournalIdOrderByThumbupCountDesc(journalId);
if(commentList.size()>0){
commentList= commentList.stream().map(comment -> {
UserInfoDTO userInfoDTO =userClient.findByUserId(comment.getUserId());

Loading…
Cancel
Save