Browse Source

查询文章接口新增拉黑用户细节

fangqing 6 tháng trước cách đây
mục cha
commit
96c0f4bafd

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

@@ -103,6 +103,9 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
     @Autowired
     private CommunityCollectionMapper communityCollectionMapper;
 
+    @Autowired
+    private CommunityUserBlockMapper communityUserBlockMapper;
+
     /**
      * 查询文章列表
      *
@@ -129,6 +132,18 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
         rspData.setTotal(communityArticleMapper.selectCommunityArticleCount(communityArticle, classIds, searchType));
         List<CommunityArticleVo> communityArticleVos_copy = new ArrayList<>(communityArticleVos);
         for (CommunityArticleVo articleVo : communityArticleVos_copy) {
+            //判断当前文章是否被用户拉黑
+            List<CommunityUserBlock> communityUserBlocks = communityUserBlockMapper.selectList(new QueryWrapper<CommunityUserBlock>()
+                    .eq("user_id", userId)
+                    .eq("peer_id", articleVo.getUserId()));
+
+            for (CommunityUserBlock userBlock : communityUserBlocks) {
+                if (userBlock.isBlock()) {
+                    communityArticleVos.remove(articleVo);
+                    break;
+                }
+            }
+
             List<Map<String, Object>> imageList = articleVo.getImageList();
             articleVo.setClassIds(classIds);
             List<CommunityArticleImages> videoList = new ArrayList<>();