Forráskód Böngészése

文章新增主页分类字段

fangzhen 5 hónapja
szülő
commit
f824af4828

+ 7 - 0
ruoyi-generator/src/main/java/com/ruoyi/generator/domain/Community/CommunityArticle.java

@@ -129,6 +129,13 @@ public class CommunityArticle implements Serializable {
     @ApiModelProperty("浏览量")
     private long pageViews;
 
+    /**
+     * 页面标签类型
+     */
+    @ApiModelProperty("页面标签类型:发现/关注")
+    @TableField(exist = false)
+    private Integer pageTagType;
+
     /**
      * 是否已删除
      */

+ 11 - 1
ruoyi-generator/src/main/java/com/ruoyi/generator/service/CommunityArticleServiceImpl.java

@@ -124,12 +124,22 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
      */
     @Override
     public List<CommunityArticleVo> selectCommunityArticleList(TableDataInfo rspData, CommunityArticle communityArticle, int pageNum, int pageSize, int searchType) {
+
+        List<CommunityArticleVo> communityArticleVos = null;
         //找出板块下的分类
         List<Long> classIds = communityArticle.getClassIds();
         Long id = communityArticle.getId();
         List<Long> articleIds = communityArticle.getArticleIds();
+        Integer pageTagType = communityArticle.getPageTagType();
+        if (pageTagType != null && pageTagType == 1) {
+            List<CommunityUserLikeVo> communityUserLikeVos = selectCommunityUserLikeList(SecurityUtils.getUserId(), null, 1, 999999, 1);
+            if (communityUserLikeVos.isEmpty()) {
+                return communityArticleVos;
+            }
+            List<Long> likeUserIds = communityUserLikeVos.stream().map(CommunityUserLikeVo::getLikeUserId).collect(Collectors.toList());
+            communityArticle.setUserIds(likeUserIds);
+        }
         Long userId = SecurityUtils.getUserId();
-        List<CommunityArticleVo> communityArticleVos = null;
         if (Objects.nonNull(id)) {
             //获取指定文章详细内容,文章浏览量+1
             CommunityArticle article = communityArticleMapper.selectById(id);