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;
@ApiModelProperty("用户账号")
@TableField(exist = false)
private String userAccount;
@ApiModelProperty("用户名")
@TableField(exist = false)
private String userName;
@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.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<QuestionAnswerCommentMapper, QuestionAnswerCommentEntity> implements QuestionAnswerCommentService {
private final IUserClient userClient;
@Override
public QuestionAnswerCommentEntity getComment(Long userId, String questionId) {
LambdaQueryWrapper<QuestionAnswerCommentEntity> queryWrapper = Wrappers.<QuestionAnswerCommentEntity>lambdaQuery()
@ -57,10 +62,17 @@ public class QuestionAnswerCommentServiceImpl extends ServiceImpl<QuestionAnswer
@Override
public List<QuestionAnswerCommentEntity> listByQuestionId(String questionId) {
return this.list(Wrappers.<QuestionAnswerCommentEntity>lambdaQuery()
List<QuestionAnswerCommentEntity> list = this.list(Wrappers.<QuestionAnswerCommentEntity>lambdaQuery()
.eq(QuestionAnswerCommentEntity::getQuestionId, questionId)
.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

Loading…
Cancel
Save