use of com.duan.blogos.entity.blog.BlogComment in project BlogSystem by DuanJiaNing.
the class BlogBrowseServiceImpl method listBlogComment.
@Override
public ResultBean<List<BlogCommentDTO>> listBlogComment(int blogId, int offset, int rows) {
List<BlogCommentDTO> result = new ArrayList<>();
List<BlogComment> comments = commentDao.listCommentByBlogId(blogId, offset, rows, BlogCommentStatusEnum.RIGHTFUL.getCode());
for (BlogComment comment : comments) {
// 评论者数据
int sid = comment.getSpokesmanId();
BloggerAccount smAccount = accountDao.getAccountById(sid);
BloggerProfile smProfile = getProfile(sid);
BloggerDTO smDTO = dataFillingManager.bloggerAccountToDTO(smAccount, smProfile, getAvatar(smProfile.getAvatarId()));
BlogCommentDTO dto = dataFillingManager.blogCommentToDTO(comment, smDTO);
result.add(dto);
}
return CollectionUtils.isEmpty(result) ? null : new ResultBean<>(result);
}
use of com.duan.blogos.entity.blog.BlogComment in project BlogSystem by DuanJiaNing.
the class BloggerCommentServiceImpl method insertComment.
@Override
public int insertComment(int blogId, int spokesmanId, int listenerId, int state, String content) {
BlogComment comment = new BlogComment();
comment.setBlogId(blogId);
comment.setContent(content);
comment.setListenerId(listenerId);
comment.setSpokesmanId(spokesmanId);
comment.setState(state);
commentDao.insert(comment);
// 博文评论次数加一
statisticsDao.updateCommentCountPlus(blogId);
Integer id = comment.getId();
return id == null ? -1 : id;
}
Aggregations