Browse Source

add:问题点赞和评论

zhongwei
luyie 2 months ago
parent
commit
ea779a6bdd
  1. 2
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/entity/QuestionAnswerCommentEntity.java
  2. 16
      hzims-service/gglm-big-model/src/main/java/com/hnac/gglm/bigmodel/maintenance/service/impl/QuestionAnswerCommentServiceImpl.java

2
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; private Long userId;
@ApiModelProperty("用户账号") @ApiModelProperty("用户账号")
@TableField(exist = false)
private String userAccount; private String userAccount;
@ApiModelProperty("用户名") @ApiModelProperty("用户名")
@TableField(exist = false)
private String userName; private String userName;
@ApiModelProperty("点赞") @ApiModelProperty("点赞")

16
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.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.ObjectUtil; 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 org.springframework.stereotype.Service;
import java.util.List; import java.util.List;
@ -26,6 +29,8 @@ import java.util.List;
@AllArgsConstructor @AllArgsConstructor
@DS("hznlm") @DS("hznlm")
public class QuestionAnswerCommentServiceImpl extends ServiceImpl<QuestionAnswerCommentMapper, QuestionAnswerCommentEntity> implements QuestionAnswerCommentService { public class QuestionAnswerCommentServiceImpl extends ServiceImpl<QuestionAnswerCommentMapper, QuestionAnswerCommentEntity> implements QuestionAnswerCommentService {
private final IUserClient userClient;
@Override @Override
public QuestionAnswerCommentEntity getComment(Long userId, String questionId) { public QuestionAnswerCommentEntity getComment(Long userId, String questionId) {
LambdaQueryWrapper<QuestionAnswerCommentEntity> queryWrapper = Wrappers.<QuestionAnswerCommentEntity>lambdaQuery() LambdaQueryWrapper<QuestionAnswerCommentEntity> queryWrapper = Wrappers.<QuestionAnswerCommentEntity>lambdaQuery()
@ -57,10 +62,17 @@ public class QuestionAnswerCommentServiceImpl extends ServiceImpl<QuestionAnswer
@Override @Override
public List<QuestionAnswerCommentEntity> listByQuestionId(String questionId) { public List<QuestionAnswerCommentEntity> listByQuestionId(String questionId) {
List<QuestionAnswerCommentEntity> list = this.list(Wrappers.<QuestionAnswerCommentEntity>lambdaQuery()
return this.list(Wrappers.<QuestionAnswerCommentEntity>lambdaQuery()
.eq(QuestionAnswerCommentEntity::getQuestionId, questionId) .eq(QuestionAnswerCommentEntity::getQuestionId, questionId)
.orderByAsc(QuestionAnswerCommentEntity::getCreateTime)); .orderByAsc(QuestionAnswerCommentEntity::getCreateTime));
list.forEach(item -> {
R<User> user = userClient.userInfoById(item.getUserId());
if (user.isSuccess() && user.getData() != null) {
item.setUserName(user.getData().getName());
item.setUserAccount(user.getData().getAccount());
}
});
return list;
} }
@Override @Override

Loading…
Cancel
Save