Commit 589084e0 by Author name

2.12 我关注的用户的动态列表

parent 7534649c
......@@ -248,14 +248,19 @@ public class PostServiceImpl extends ServiceImpl<PostMapper, Post> implements IP
//查询出我所关注的用户
QueryWrapper<UserFollow> userFollowQueryWrapper = new QueryWrapper<>();
userFollowQueryWrapper.eq("follower_id", userId);
List<String> followdeIds = userFollowService.list(userFollowQueryWrapper).stream()
userFollowQueryWrapper.eq("follow_status", 0);
List<String> followedIds = userFollowService.list(userFollowQueryWrapper).stream()
.map(UserFollow::getFollowedId)
.collect(Collectors.toList());
//获取我关注的用户的动态
if (!CollectionUtils.isEmpty(followedIds)) {
QueryWrapper<Post> postQueryWrapper = new QueryWrapper<>();
postQueryWrapper.in("user_id", followdeIds);
postQueryWrapper.in("user_id", followedIds);
postQueryWrapper.orderByDesc("create_time");
return page(postPage, postQueryWrapper);
} else {
return postPage;
}
}
......
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