|
@@ -42,6 +42,7 @@ public class CommunityArticleServiceImpl implements ICommunityArticleService {
|
|
|
public List<CommunityArticleVo> selectCommunityArticleList(CommunityArticle communityArticle) {
|
|
|
List<CommunityArticleVo> communityArticleVos = communityArticleMapper.selectCommunityArticleList(communityArticle);
|
|
|
CommunityArticleVo communityArticleVo = null;
|
|
|
+ Long userId = SecurityUtils.getUserId();
|
|
|
for (int i = 0; i < communityArticleVos.size(); i++) {
|
|
|
communityArticleVo = communityArticleVos.get(i);
|
|
|
//文章下的评论
|
|
@@ -53,11 +54,11 @@ public class CommunityArticleServiceImpl implements ICommunityArticleService {
|
|
|
communityArticleCommentVo.setAvatar(sysUser.getAvatar());
|
|
|
|
|
|
//判断是否已收藏
|
|
|
- CommunityArticleCollect collect = communityArticleMapper.selectCommunityArticleCollectById(SecurityUtils.getUserId(), communityArticleCommentVo.getArticleId());
|
|
|
+ CommunityArticleCollect collect = communityArticleMapper.selectCommunityArticleCollectById(userId, communityArticleCommentVo.getArticleId());
|
|
|
communityArticleVo.setCollect(!Objects.isNull(collect));
|
|
|
|
|
|
//判断是否已点赞
|
|
|
- CommunityLike like = communityArticleMapper.selectCommunityArticleLikeById(SecurityUtils.getUserId(), communityArticleCommentVo.getArticleId());
|
|
|
+ CommunityLike like = communityArticleMapper.selectCommunityArticleLikeById(userId, communityArticleCommentVo.getArticleId());
|
|
|
communityArticleVo.setLike(!Objects.isNull(like));
|
|
|
}
|
|
|
}
|