Bläddra i källkod

删除费代码

fangzhen 7 månader sedan
förälder
incheckning
954b93de11

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

@@ -180,81 +180,6 @@ public class CommunityArticleServiceImpl extends ServiceImpl<CommunityArticleMap
         return communityArticleVos;
     }
 
-//    @Override
-//    public List<CommunityArticleVo> selectCommunityArticleList1(CommunityArticle communityArticle, int pageNum, int pageSize) {
-//        Long classId = communityArticle.getClassId();
-//        Long userId = SecurityUtils.getUserId();
-//        List<Long> circleIds = null;
-//
-//        // 获取分类圈子ID
-//        if (classId != null) {
-//            circleIds = communityClassCircleMapper.getCircleIdsByClassId(classId);
-//        }
-//
-//        // 使用分页和偏移量查询文章
-//        int offset = (pageNum - 1) * pageSize;
-//        List<CommunityArticleVo> communityArticleVos = communityArticleMapper.selectCommunityArticleList(communityArticle, circleIds, offset, pageSize);
-//
-//        // 批量获取文章ID列表
-//        List<Long> articleIds = communityArticleVos.stream().map(CommunityArticleVo::getId).collect(Collectors.toList());
-//
-//        if (!articleIds.isEmpty()) {
-//            // 批量查询点赞、收藏、评论等相关信息,减少单次查询
-//            Map<Long, Integer> likeCounts = communityLikeMapper.getLikeCountsByArticleIds(articleIds);
-//            Map<Long, Integer> collectCounts = communityCollectMapper.getCollectCountsByArticleIds(articleIds);
-//            Map<Long, List<CommunityArticleImages>> imagesMap = communityArticleImagesMapper.getImagesByArticleIds(articleIds);
-//            Map<Long, List<CommunityArticleCommentVo>> commentsMap = communityArticleCommentMapper.getCommentsByArticleIds(articleIds);
-//
-//            // 批量获取用户是否点赞/收藏信息
-//            Map<Long, Boolean> userLikes = communityLikeMapper.getUserLikesByArticleIds(userId, articleIds);
-//            Map<Long, Boolean> userCollects = communityCollectMapper.getUserCollectsByArticleIds(userId, articleIds);
-//
-//            for (CommunityArticleVo articleVo : communityArticleVos) {
-//                Long articleId = articleVo.getId();
-//
-//                // 设置文章的点赞和收藏数量
-//                articleVo.setLikeCount(likeCounts.getOrDefault(articleId, 0));
-//                articleVo.setCollectCount(collectCounts.getOrDefault(articleId, 0));
-//
-//                // 设置用户点赞/收藏状态
-//                articleVo.setLike(userLikes.getOrDefault(articleId, false));
-//                articleVo.setCollect(userCollects.getOrDefault(articleId, false));
-//
-//                // 设置图片和视频
-//                List<CommunityArticleImages> imageList = imagesMap.get(articleId);
-//                List<CommunityArticleImages> videoList = new ArrayList<>();
-//                if (imageList != null) {
-//                    for (Iterator<CommunityArticleImages> iterator = imageList.iterator(); iterator.hasNext(); ) {
-//                        CommunityArticleImages image = iterator.next();
-//                        if (isVideoFile(image.getImageUrl())) {
-//                            videoList.add(image);
-//                            iterator.remove();
-//                        }
-//                    }
-//                }
-//                articleVo.setImageList(imageList);
-//                articleVo.setVideoList(videoList);
-//
-//                // 设置评论信息
-//                List<CommunityArticleCommentVo> comments = commentsMap.get(articleId);
-//                if (comments != null) {
-//                    for (CommunityArticleCommentVo comment : comments) {
-//                        // 设置评论的用户信息及点赞状态
-//                        SysUser sysUser = sysUserMapper.selectUserById(comment.getUserId());
-//                        comment.setUsername(sysUser.getUserName());
-//                        comment.setAvatar(sysUser.getAvatar());
-//                        comment.setCommentLike(communityCommentLikeMapper.isUserLikedComment(comment.getId(), userId));
-//                        comment.setCommentLikeCount(communityCommentLikeMapper.getCommentLikeCount(comment.getId()));
-//                    }
-//                    articleVo.setComments(comments);
-//                }
-//            }
-//        }
-//        return communityArticleVos;
-//    }
-
-
-
     /**
      * 发布文章
      *

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

@@ -23,7 +23,7 @@ public interface ICommunityArticleService extends IService<CommunityArticle> {
      * @return 文章信息集合
      */
     List<CommunityArticleVo> selectCommunityArticleList(CommunityArticle communityArticle, int pageNum, int pageSize);
-    //List<CommunityArticleVo> selectCommunityArticleList1(CommunityArticle communityArticle, int pageNum, int pageSize);
+
     /**
      * 发布文章
      *