Esempio n. 1
0
 @Override
 public List<Comment> listCommentAndPraise(Comment comment, PageBase pageBase) {
   List<?> commentList = commentDao.listComment(comment);
   commentList = CommonUtils.createListPage(commentList, pageBase);
   List<Comment> returnCommentList = new ArrayList<Comment>();
   for (Object objTmp : commentList) {
     // 判断每个comment
     Comment commentTmp = ((Comment) objTmp);
     // 判断每个评论的点赞数
     Praise praise = new Praise();
     praise.setPraisetype(Constant.PRAISE_TYPE_COMMENT);
     praise.setOtherid(commentTmp.getCommentid());
     commentTmp.setPraisecount(praiseDao.countPraise(praise));
     praise.setUserid(comment.getUserid());
     if (null == praiseDao.detailPraise(praise)) {
       // 如果点赞为空,则说明还未点赞
       commentTmp.setIspraise(Constant.COMMENT_NOT_PRAISE);
     } else {
       // 如果点赞不为空,则说明已经点赞
       commentTmp.setIspraise(Constant.COMMENT_HAS_PRAISE);
     }
     // 清理掉无关的
     commentTmp.setUserid(null);
     returnCommentList.add(commentTmp);
   }
   return returnCommentList;
 }
Esempio n. 2
0
  @Override
  public int countComment(Comment comment) {

    return commentDao.countComment(comment);
  }
Esempio n. 3
0
  @Override
  public int addComment(Comment comment) {

    return commentDao.insert(comment);
  }
Esempio n. 4
0
  @Override
  public int deleteComment(int uid) {

    return commentDao.deleteByPrimaryKey(uid);
  }
Esempio n. 5
0
  @Override
  public int updateComment(Comment comment) {

    return commentDao.updateByPrimaryKeySelective(comment);
  }
Esempio n. 6
0
  @Override
  public Comment detailComment(Comment comment) {

    return commentDao.detailComment(comment);
  }
Esempio n. 7
0
  @Override
  public List<Comment> listComment(Comment comment) {

    return commentDao.listComment(comment);
  }