【转载】Springboot2.x 带参数路径访问

参考

  1. springboot带参数路径访问

正文

/**
     * 根据id获取学生信息
     */
    @ApiOperation(value = "显示学生信息", notes = "查看别人的(隐藏部分字段)")
    @ApiImplicitParam(name = "id", value = "学生id", required = true,
            dataType = "int")
    @RequestMapping(value = "show/{id}", method = RequestMethod.GET, consumes = "application/json", produces = "application/json;charset=UTF-8")
    public ResponseEntity<ResponseBodyDto<InfoStudentDto>> show(@PathVariable("id") Integer id){
        InfoStudentDto infoStudentDto = modelMapper.map(studentService.findById(id), InfoStudentDto.class);
        return ResponseEntity.ok( new ResponseBodyDto(infoStudentDto));
    }
posted @ 2021-08-08 15:16  夏秋初  阅读(278)  评论(0)    收藏  举报