天机学堂day5作业,查询问答详情--管理端

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;
    }

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值