From ea779a6bdda449d33576422a0181013fce46a321 Mon Sep 17 00:00:00 2001 From: luyie Date: Sat, 21 Sep 2024 15:18:37 +0800 Subject: [PATCH] =?UTF-8?q?add:=E9=97=AE=E9=A2=98=E7=82=B9=E8=B5=9E?= =?UTF-8?q?=E5=92=8C=E8=AF=84=E8=AE=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../maintenance/entity/QuestionAnswerCommentEntity.java | 2 ++ .../service/impl/QuestionAnswerCommentServiceImpl.java | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/QuestionAnswerCommentEntity.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/QuestionAnswerCommentEntity.java index 27a672d..e8ee50c 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/QuestionAnswerCommentEntity.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/QuestionAnswerCommentEntity.java @@ -35,9 +35,11 @@ public class QuestionAnswerCommentEntity extends TenantEntity implements Seriali private Long userId; @ApiModelProperty("用户账号") + @TableField(exist = false) private String userAccount; @ApiModelProperty("用户名") + @TableField(exist = false) private String userName; @ApiModelProperty("点赞") diff --git a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/QuestionAnswerCommentServiceImpl.java b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/QuestionAnswerCommentServiceImpl.java index 6456cdc..4898537 100644 --- a/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/QuestionAnswerCommentServiceImpl.java +++ b/hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/QuestionAnswerCommentServiceImpl.java @@ -12,7 +12,10 @@ import com.hnac.gglm.bigmodel.maintenance.vo.AnswerPraiseRequest; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.secure.utils.AuthUtil; +import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.ObjectUtil; +import org.springblade.system.user.entity.User; +import org.springblade.system.user.feign.IUserClient; import org.springframework.stereotype.Service; import java.util.List; @@ -26,6 +29,8 @@ import java.util.List; @AllArgsConstructor @DS("hznlm") public class QuestionAnswerCommentServiceImpl extends ServiceImpl implements QuestionAnswerCommentService { + private final IUserClient userClient; + @Override public QuestionAnswerCommentEntity getComment(Long userId, String questionId) { LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery() @@ -57,10 +62,17 @@ public class QuestionAnswerCommentServiceImpl extends ServiceImpl listByQuestionId(String questionId) { - - return this.list(Wrappers.lambdaQuery() + List list = this.list(Wrappers.lambdaQuery() .eq(QuestionAnswerCommentEntity::getQuestionId, questionId) .orderByAsc(QuestionAnswerCommentEntity::getCreateTime)); + list.forEach(item -> { + R user = userClient.userInfoById(item.getUserId()); + if (user.isSuccess() && user.getData() != null) { + item.setUserName(user.getData().getName()); + item.setUserAccount(user.getData().getAccount()); + } + }); + return list; } @Override