Commit 8fd328fb by Author name

2.11 删除博客时跟新引用次数

parent e8f9b254
......@@ -203,8 +203,10 @@ public class BlogServiceImpl extends ServiceImpl<BlogMapper, Blog> implements IB
QueryWrapper<BlogTag> queryWrapperTag = new QueryWrapper();
queryWrapperTag.eq("blog_id", blogId);
//引用标签数量减一
List<String> tags = blogTagService.list(queryWrapperTag).stream().map(BlogTag::getTagId).collect(Collectors.toList());
tagService.decreaseReferenceCountBatch(tags,1);
List<String> tagIds = blogTagService.list(queryWrapperTag).stream().map(BlogTag::getTagId).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(tagIds)) {
tagService.decreaseReferenceCountBatch(tagIds,1);
}
blogTagService.remove(queryWrapperTag);
//5.删除博客引用的话题
......@@ -212,7 +214,9 @@ public class BlogServiceImpl extends ServiceImpl<BlogMapper, Blog> implements IB
queryWrapperTopic.eq("referencer_id", blogId);
//引用话题数量减一
List<String> topicIds = topicReferenceService.list(queryWrapperTopic).stream().map(TopicReference::getTopicId).collect(Collectors.toList());
topicService.decreaseReferenceCountBatch(topicIds, 1);
if (!CollectionUtils.isEmpty(topicIds)) {
topicService.decreaseReferenceCountBatch(topicIds, 1);
}
topicReferenceService.remove(queryWrapperTopic);
//6.删除博客表里的数据
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment