浏览代码

查询合集下文章信息新增文章内容字段

fangqing 5 月之前
父节点
当前提交
7501b861f6

+ 4 - 5
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityArticleServiceImpl.java

@@ -149,18 +149,16 @@ 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);
-                        }
+                articleVo.setCare(communityUserLike.getUserId() != null);
             }
+
         /*    communityArticleMapper.selectList();
             articleVo.setCare();*/
 
@@ -843,6 +841,7 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
                 = communityUserPromptMapper
                 .selectList(new QueryWrapper<CommunityUserPrompt>().eq("user_id", userId));
 
+
         // 创建一个用于存放VO的列表
         List<CommunityUserPromptVo> communityUserPromptVos = new ArrayList<>();
         // 遍历查询结果,复制属性到 VO 对象

+ 2 - 1
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityCollectionServiceImpl.java

@@ -116,7 +116,7 @@ public class CommunityCollectionServiceImpl extends ServiceImpl<CommunityCollect
         }
         SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
         String formattedUpdateTime = sdf.format(updateTime);
-        collectionObject.put("CreateBy",communityCollection.getCreateBy());
+        collectionObject.put("collectioncreateby",communityCollection.getCreateBy());
         collectionObject.put("updateTime",formattedUpdateTime);
         collectionObject.put("followNumber", communityCollectionUserMapper.selectList(new QueryWrapper<CommunityCollectionUser>().eq("collection_id",collectionId).and((wrapper) -> {
             wrapper.ne("is_delete", true)
@@ -187,6 +187,7 @@ public class CommunityCollectionServiceImpl extends ServiceImpl<CommunityCollect
             collectionArticleVo.setCollectionId(collectionId);
             collectionArticleVo.setTitle(communityArticle.getTitle());
             collectionArticleVo.setArticleCreateTime(communityArticle.getCreateTime());
+            collectionArticleVo.setContent(communityArticle.getContent());
 
             //设置用户点赞数
             int likeCount = communityLikeMapper.selectCount(new QueryWrapper<CommunityLike>().eq("article_id", communityArticle.getId())).intValue();

+ 7 - 0
ruoyi-generator/src/main/java/com/ruoyi/generator/vo/CommunityCollectionArticleVo.java

@@ -46,6 +46,13 @@ public class CommunityCollectionArticleVo implements Serializable {
     @ApiModelProperty("文章标题")
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private String title;
+
+    /**
+     * 文章内容
+     */
+    @ApiModelProperty("文章内容")
+    private String content;
+
     /**
      * 文章点赞数
      */