소스 검색

文章新增是否关注字段

fangqing 5 달 전
부모
커밋
8734e13bf1

+ 15 - 0
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityArticleServiceImpl.java

@@ -149,6 +149,21 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
                 }
             }
 
+            List<CommunityUserLike> communityUserLikes = communityUserLikeMapper.selectList(new QueryWrapper<CommunityUserLike>()
+                    .eq("user_id",userId)
+                    .eq("like_user_id",articleVo.getUserId())
+            );
+
+            for (CommunityUserLike communityUserLike : communityUserLikes) {
+                        if (communityUserLike.getUserId() != null){
+                            articleVo.setCare(true);
+                        }else {
+                            articleVo.setCare(false);
+                        }
+            }
+        /*    communityArticleMapper.selectList();
+            articleVo.setCare();*/
+
             List<Map<String, Object>> imageList = articleVo.getImageList();
             articleVo.setClassIds(classIds);
             List<CommunityArticleImages> videoList = new ArrayList<>();

+ 6 - 0
ruoyi-generator/src/main/java/com/ruoyi/generator/vo/CommunityArticleVo.java

@@ -138,4 +138,10 @@ public class CommunityArticleVo extends BaseEntity implements Serializable {
      */
     @ApiModelProperty("是否已拉黑")
     private boolean isBlock;
+
+    /**
+     * 关注
+     */
+    @ApiModelProperty("关注")
+    private boolean isCare;
 }