use of com.dimple.project.blog.domain.Blog in project DimpleBlog by martin-chips.
the class BlogServiceImpl method selectBlogById.
@Override
public Blog selectBlogById(Long id) {
Blog blog = blogMapper.selectBlogById(id);
blog.setTagTitleList(getTagTitleListByBlogId(id));
return blog;
}
use of com.dimple.project.blog.domain.Blog in project DimpleBlog by martin-chips.
the class BlogServiceImpl method selectBlogDetailById.
@Override
public Blog selectBlogDetailById(Long id) {
Blog blog = blogMapper.selectBlogByIdQuery(id);
blog.setTagList(tagService.selectTagListByBlogId(id));
// 获取commentList
blog.setCommentList(commentMapper.selectCommentListByPageId(id));
// 设置点击数量+1
blogMapper.incrementBlogClick(id);
return blog;
}
use of com.dimple.project.blog.domain.Blog in project DimpleBlog by martin-chips.
the class CategoryServiceImpl method selectCategoryList.
@Override
public List<Category> selectCategoryList(Category bgCategory) {
List<Category> categoryList = bgCategoryMapper.selectCategoryList(bgCategory);
List<Long> categoryIds = categoryList.stream().map(Category::getId).collect(Collectors.toList());
if (ObjectUtils.isEmpty(categoryIds)) {
return categoryList;
}
List<Blog> blogList = blogMapper.selectBlogListByCategoryIds(categoryIds);
for (Category category : categoryList) {
List<Blog> collect = blogList.stream().filter(e -> category.getId().equals(e.getCategoryId())).collect(Collectors.toList());
category.setBlogList(collect);
}
return categoryList;
}
use of com.dimple.project.blog.domain.Blog in project DimpleBlog by martin-chips.
the class FrontController method blogDetail.
@GetMapping("/blog/{id}")
@VLog(title = "查看博客", pageId = "#id")
public AjaxResult blogDetail(@PathVariable Long id) {
Blog blog = frontService.selectBlogDetailById(id);
frontService.incrementBlogClick(id);
return AjaxResult.success(blog);
}
use of com.dimple.project.blog.domain.Blog in project DimpleBlog by martin-chips.
the class FrontServiceImpl method selectBlogDetailById.
@Override
@Cacheable(value = CacheConstants.CACHE_NAME_FRONT_BLOG_ITEM, key = "'BlogId:' +#id")
@CacheExpire(expire = 1, type = TimeType.MINUTES)
public Blog selectBlogDetailById(Long id) {
Blog blog = frontMapper.selectBlogDetailById(id);
// get all comment
blog.setCommentList(selectCommentListByPageId(id));
return blog;
}
Aggregations