Commit 0a52c239 by 段启岩

修复博客博客引用错误

parent 02603811
......@@ -369,8 +369,11 @@ public class BlogServiceImpl extends ServiceImpl<BlogMapper, Blog> implements IB
topicReferenceService.list(topicReferenceQueryWrapper).stream()
.map(TopicReference::getTopicId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(referencedTopicIds)) {
// 减少话题引用测试
topicService.decreaseReferenceCountBatch(referencedTopicIds, 1);
}
// 删除话题引用
topicReferenceService.remove(topicReferenceQueryWrapper);
}
......@@ -384,10 +387,8 @@ public class BlogServiceImpl extends ServiceImpl<BlogMapper, Blog> implements IB
}
// 批量保存
topicReferenceService.saveBatch(topicReferenceList);
// 更新话题引用次数
existsTopicIds.forEach(topicId -> {
topicService.increaseReferenceCount(topicId, 1);
});
// 新增话题引用次数
topicService.increaseReferenceCountBatch(existsTopicIds, 1);
}
}
......@@ -405,8 +406,10 @@ public class BlogServiceImpl extends ServiceImpl<BlogMapper, Blog> implements IB
blogTagService.list(blogTagQueryWrapper).stream()
.map(BlogTag::getTagId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(referencedTagIds)) {
// 减少标签引用次数
tagService.decreaseReferenceCountBatch(referencedTagIds, 1);
}
// 删除标签引用
blogTagService.remove(blogTagQueryWrapper);
}
......@@ -417,7 +420,10 @@ public class BlogServiceImpl extends ServiceImpl<BlogMapper, Blog> implements IB
blogTag.setTagId(tagId);
blogTagList.add(blogTag);
}
// 保存标签引用
blogTagService.saveBatch(blogTagList);
// 删除标签引用次数
tagService.increaseReferenceCountBatch(existsTagIds, 1);
}
}
}
......
......@@ -332,8 +332,10 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
topicReferenceService.list(topicReferenceQueryWrapper).stream()
.map(TopicReference::getTopicId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(referencedTopicIds)) {
// 减少话题引用数量
topicService.decreaseReferenceCountBatch(referencedTopicIds, 1);
}
// 删除话题引用
topicReferenceService.remove(topicReferenceQueryWrapper);
}
......@@ -349,7 +351,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
}).collect(Collectors.toList());
// 保存话题引用
topicReferenceService.saveBatch(topicReferenceList);
// 更新话题引用次数
// 增加话题引用次数
topicService.increaseReferenceCountBatch(existsTopicIds, 1);
}
}
......@@ -368,8 +370,10 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
questionTagService.list(questionTagQueryWrapper).stream()
.map(QuestionTag::getTagId).collect(Collectors.toList());
if (CollectionUtils.isEmpty(referencedTagIds)) {
// 减少标签引用数量
tagService.decreaseReferenceCountBatch(referencedTagIds, 1);
}
// 删除标签引用
questionTagService.remove(questionTagQueryWrapper);
}
......@@ -381,8 +385,9 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
questionTag.setTagId(tagId);
return questionTag;
}).collect(Collectors.toList());
// 保存标签引用
questionTagService.saveBatch(questionTagList);
// 更新标签引用次数
// 增加标签引用次数
tagService.increaseReferenceCountBatch(existsTagIds, 1);
}
}
......
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