Selaa lähdekoodia

修正查询文章列表没有板块bug

fangqing 4 kuukautta sitten
vanhempi
sitoutus
7e2c48caea

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

@@ -120,6 +120,8 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
     @Autowired
     @Autowired
     private CommunityCommentRaffleMapper communityCommentRaffleMapper;
     private CommunityCommentRaffleMapper communityCommentRaffleMapper;
 
 
+    @Autowired
+    private CommunityArticleCircleMapper communityArticleCircleMapper;
     /**
     /**
      * 查询文章列表
      * 查询文章列表
      *
      *
@@ -217,7 +219,20 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
             articleVo.setCare();*/
             articleVo.setCare();*/
 
 
             List<Map<String, Object>> imageList = articleVo.getImageList();
             List<Map<String, Object>> imageList = articleVo.getImageList();
-            articleVo.setClassIds(classIds);
+
+            //设置文章的板块
+            List<CommunityArticleClass> articleId = communityArticleCircleMapper.selectList(
+                    new QueryWrapper<CommunityArticleClass>()
+                            .eq("article_id", articleVo.getId())
+            );
+            // 使用 Java Streams API 提取 classId,并转换成 List<Long>
+            List<Long> classIdss = articleId.stream()
+                    .map(CommunityArticleClass::getClassId)
+                    .collect(Collectors.toList());
+
+            articleVo.setClassIds(classIdss);
+
+
             List<CommunityArticleImages> videoList = new ArrayList<>();
             List<CommunityArticleImages> videoList = new ArrayList<>();
             CommunityArticleImages videos = null;
             CommunityArticleImages videos = null;
             List<Map<String, Object>> imageList_copy = new ArrayList<>(imageList);
             List<Map<String, Object>> imageList_copy = new ArrayList<>(imageList);
@@ -249,6 +264,9 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
             //设置文章所属合集
             //设置文章所属合集
             articleVo.setCollectionVo(communityCollectionMapper.selectCollectById(userId, articleVo.getId()));
             articleVo.setCollectionVo(communityCollectionMapper.selectCollectById(userId, articleVo.getId()));
 
 
+
+
+
             //设置中奖信息
             //设置中奖信息
             CommunityCommentRaffleVo communityCommentRaffleVo = new CommunityCommentRaffleVo();
             CommunityCommentRaffleVo communityCommentRaffleVo = new CommunityCommentRaffleVo();
             CommunityCommentRaffle communityCommentRaffle = communityCommentRaffleMapper.selectOne(
             CommunityCommentRaffle communityCommentRaffle = communityCommentRaffleMapper.selectOne(