doum
19 小时以前 25538c1063d1e9a2d8dac1b813d43e7d8fb18e3f
server/dmmall_service/src/main/java/com/doumee/service/business/impl/CommentServiceImpl.java
@@ -82,16 +82,22 @@
        target.setType(Constants.ZERO);
        if (comment.getReplyId() != null){
            Comment reply = commentMapper.selectById(comment.getReplyId());
            Comment reply = commentMapper.selectJoinOne(Comment.class,new MPJLambdaWrapper<Comment>()
                    .selectAll(Comment.class)
                    .selectAs(Member::getNickname,Comment::getReplyMemberNikeName)
                    .leftJoin(Member.class,Member::getId,Comment::getMemberId)
                    .eq(Comment::getId,comment.getReplyId())
            );
            reply = Optional.ofNullable(reply).orElseThrow(() -> new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "回复目标不存在"));
            target.setReplyId(reply.getId());
            target.setReplyMemberId(reply.getMemberId());
            target.setReplyMemberNikeName(reply.getReplyMemberNikeName());
            target.setCommentId(reply.getId());
            target.setCommentMemberId(reply.getMemberId());
            target.setType(Constants.ONE);
        }
        if (comment.getCommentId() != null ){
            target.setCommentId(reply.getCommentId());
            target.setCommentMemberId(reply.getCommentMemberId());
        }else if (comment.getCommentId() != null ){
            Comment reply = commentMapper.selectById(comment.getCommentId());
            reply = Optional.ofNullable(reply).orElseThrow(() -> new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "一级评论目标不存在"));
            target.setCommentId(reply.getCommentId());
@@ -269,6 +275,7 @@
        replyWrapper.eq(Comment::getType, Constants.ONE);
        replyWrapper.eq(Comment::getStatus, Constants.ZERO);
        replyWrapper.in(Comment::getCommentId,commentIds);
        replyWrapper.orderByDesc(Comment::getId);
        replyWrapper.groupBy(Comment::getCommentId);
        List<ActivityReplyCommentDTO> activityCommentDTOS = commentJoinMapper.selectJoinList(ActivityReplyCommentDTO.class, replyWrapper);
@@ -335,6 +342,7 @@
        queryWrapper.eq(Comment::getType, Constants.ONE);
        queryWrapper.eq(Comment::getStatus, Constants.ZERO);
        queryWrapper.eq(Comment::getCommentId,pageWrap.getModel().getCommentId());
        queryWrapper.orderByDesc(Comment::getId);
        IPage<ActivityReplyCommentDTO> result = commentJoinMapper.selectJoinPage(page, ActivityReplyCommentDTO.class, queryWrapper);
        if (CollectionUtils.isEmpty(result.getRecords())){
            return PageData.from(result);
@@ -368,7 +376,6 @@
                s.setReplyMemberNikeName(null);
            }
        });
        return PageData.from(result);
    }
}