InteractionReplyController
/**
* 查询问答详情--管理端
* @param id
* @return
*/
@ApiOperation("查询评论详情--管理端")
@GetMapping("/{id}")
public ReplyVO queryAdminReplyById(@PathVariable("id") Long id) {
return replyService.queryAdminReplyById(id);
}
IInteractionReplyService
/**
* 查询问答详情--管理端
* @param id
* @return
*/
ReplyVO queryAdminReplyById(Long id);
InteractionReplyServiceImpl
/**
* 查询回答详情--管理端
* @param id
* @return
*/
@Override
public ReplyVO queryAdminReplyById(Long id) {
//1、校验
if (id == null) {
throw new BadRequestException("非法参数!");
}
//2、查询interaction_reply表,按主键查询
InteractionReply reply = this.getById(id);
if (reply == null) {
throw new BadRequestException("该回答或评论不存在!");
}
//3、封装vo
ReplyVO vo = BeanUtils.copyBean(reply, ReplyVO.class);
//4、远程调用用户服务,获取用户信息
UserDTO userDTO = userClient.queryUserById(reply.getUserId());
if (userDTO != null) {
vo.setUserName(userDTO.getName()); //用户名称
vo.setUserIcon(userDTO.getIcon()); //用户头像
}
//5、返回vo
return vo;
}