Commit 0112a85b by 段启岩

修复我关注的话题和话题的关注列表

parent 4ac1f264
......@@ -16,6 +16,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.Collection;
import java.util.List;
......@@ -124,8 +125,13 @@ public class TopicServiceImpl extends ServiceImpl<TopicMapper, Topic> implements
.map(TopicFollow::getTopicId)
.collect(Collectors.toList());
// 3. 通过话题id批量查询用户
List<Topic> topics = listByIds(topicIds);
// 3. 通过话题id批量查询话题
List<Topic> topics;
if (!CollectionUtils.isEmpty(topicIds)) {
topics = listByIds(topicIds);
} else {
topics = List.of();
}
// 5.构造分页结果
IPage<Topic> userPage = new Page<>();
......@@ -156,7 +162,12 @@ public class TopicServiceImpl extends ServiceImpl<TopicMapper, Topic> implements
.collect(Collectors.toList());
// 3. 通过用户id批量查询用户
List<User> followers = userService.listByIds(followerIds);
List<User> followers;
if (!CollectionUtils.isEmpty(followerIds)) {
followers = userService.listByIds(followerIds);
} else {
followers = List.of();
}
// 4.去除敏感信息
followers.stream()
......
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