Search in sources :

Example 1 with BlogCommentDTO

use of com.duan.blogos.dto.blog.BlogCommentDTO 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);
}
Also used : BloggerDTO(com.duan.blogos.dto.blogger.BloggerDTO) BloggerAccount(com.duan.blogos.entity.blogger.BloggerAccount) ArrayList(java.util.ArrayList) BlogComment(com.duan.blogos.entity.blog.BlogComment) BlogCommentDTO(com.duan.blogos.dto.blog.BlogCommentDTO) BloggerProfile(com.duan.blogos.entity.blogger.BloggerProfile)

Aggregations

BlogCommentDTO (com.duan.blogos.dto.blog.BlogCommentDTO)1 BloggerDTO (com.duan.blogos.dto.blogger.BloggerDTO)1 BlogComment (com.duan.blogos.entity.blog.BlogComment)1 BloggerAccount (com.duan.blogos.entity.blogger.BloggerAccount)1 BloggerProfile (com.duan.blogos.entity.blogger.BloggerProfile)1 ArrayList (java.util.ArrayList)1