Search in sources :

Example 1 with BlogListItemDTO

use of com.duan.blogos.dto.blogger.BlogListItemDTO in project BlogSystem by DuanJiaNing.

the class BloggerBlogServiceImpl method constructResult.

@Override
protected ResultBean<List<BlogListItemDTO>> constructResult(Map<Integer, Blog> blogHashMap, List<BlogStatistics> statistics, Map<Integer, int[]> blogIdMapCategoryIds, Map<Integer, String> blogImgs) {
    // 重组结果
    List<BlogListItemDTO> result = new ArrayList<>();
    for (BlogStatistics s : statistics) {
        Integer blogId = s.getBlogId();
        int[] ids = blogIdMapCategoryIds.get(blogId);
        List<BlogCategory> categories = CollectionUtils.isEmpty(ids) ? null : categoryDao.listCategoryById(ids);
        Blog blog = blogHashMap.get(blogId);
        BlogListItemDTO dto = dataFillingManager.bloggerBlogListItemToDTO(blog, s, categories);
        result.add(dto);
    }
    return new ResultBean<>(result);
}
Also used : BlogCategory(com.duan.blogos.entity.blog.BlogCategory) BlogStatistics(com.duan.blogos.entity.blog.BlogStatistics) BlogListItemDTO(com.duan.blogos.dto.blogger.BlogListItemDTO) Blog(com.duan.blogos.entity.blog.Blog) ResultBean(com.duan.blogos.restful.ResultBean)

Aggregations

BlogListItemDTO (com.duan.blogos.dto.blogger.BlogListItemDTO)1 Blog (com.duan.blogos.entity.blog.Blog)1 BlogCategory (com.duan.blogos.entity.blog.BlogCategory)1 BlogStatistics (com.duan.blogos.entity.blog.BlogStatistics)1 ResultBean (com.duan.blogos.restful.ResultBean)1