报错代码:
@ApiOperation("查询教材列表") @GetMapping("/v1/app/course/courseware") public R<List<CoursewareVo>> listCourseware(@RequestBody CoursewareBo bo) { return R.ok(coursewareService.list(bo)); }
报错信息:
{ "code": 500, "msg": "Required request body is missing: public com.ruoyi.common.core.domain.R<java.util.List<org.gl.space.domain.vo.CoursewareVo>> org.gl.space.controller.CourseController.listCourseware(org.gl.space.domain.bo.CoursewareBo)", "success": false, "total": 0 }
解决方式:
因为GetMapping 不支持@RequestBody,所以去掉@RequestBody注解就可以了
@ApiOperation("查询教材列表") @GetMapping("/v1/app/course/courseware") public R<List<CoursewareVo>> listCourseware(CoursewareBo bo) { return R.ok(coursewareService.list(bo)); }
如果是需要json对象传输,改为post请求,使用@PostMapping注解也可以
@ApiOperation("查询教材列表") @PostMapping("/v1/app/course/courseware") public R<List<CoursewareVo>> listCourseware(@RequestBody CoursewareBo bo) { return R.ok(coursewareService.list(bo)); }