Commit 8e4190cc by 段启岩

话题锁定

parent 7f081ded
......@@ -151,22 +151,25 @@ public class PostServiceImpl extends ServiceImpl<PostMapper, Post> implements IP
updateById(post);
}
List<String> topicIds = topics.stream().map(Topic::getTopicId).collect(Collectors.toList());
// 关联话题和动态
List<TopicReference> topicReferences = new ArrayList<>();
for (String topicId : topicIds) {
TopicReference topicReference = new TopicReference();
topicReference.setUserId(user.getUserId());
topicReference.setTopicId(topicId);
topicReference.setReferencerId(post.getPostId());
topicReference.setReferencerType(TopicReferenceType.POST_REFERENCE.getType());
topicReferences.add(topicReference);
if (!CollectionUtils.isEmpty(unLockedTopicNames)) {
List<String> topicIds = topics.stream().map(Topic::getTopicId).collect(Collectors.toList());
// 关联话题和动态
List<TopicReference> topicReferences = new ArrayList<>();
for (String topicId : topicIds) {
TopicReference topicReference = new TopicReference();
topicReference.setUserId(user.getUserId());
topicReference.setTopicId(topicId);
topicReference.setReferencerId(post.getPostId());
topicReference.setReferencerType(TopicReferenceType.POST_REFERENCE.getType());
topicReferences.add(topicReference);
}
// 批量保存
topicReferenceService.saveBatch(topicReferences);
// 新增话题引用次数
topicService.increaseReferenceCountBatch(topicIds, 1);
}
// 批量保存
topicReferenceService.saveBatch(topicReferences);
// 新增话题引用次数
topicService.increaseReferenceCountBatch(topicIds, 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