Source code, the controller inside is the following method
@ApiOperation(value = "分页讲师列表")
@PostMapping("pageQuery/{page}/{limit}")
public R pageQuery(
@ApiParam(name = "page", value = "当前页码", required = true)
@PathVariable Long page,
@ApiParam(name = "limit", value = "每页记录数", required = true)
@PathVariable Long limit,
@ApiParam(name = "teacherQuery", value = "查询对象", required = false)
TeacherQuery teacherQuery){
Page<Teacher> pageParam = new Page<>(page, limit);
teacherService.pageQuery(pageParam, teacherQuery);
List<Teacher> records = pageParam.getRecords();
long total = pageParam.getTotal();
return R.ok().data("total", total).data("rows", records);
}
As a result, the back-end cannot accept the parameters passed by the front-end.
This is a blog and
the result is
The data sent by the front end is always in json format, unless it is placed on the path? Later, as long as the json data is sent, it can only be received with @RequestBody. Here is how I changed it:
@ApiOperation(value = "分页讲师列表22222222222")
@PostMapping("pageQuery/{page}/{limit}")
public R pageQuery(
@ApiParam(name = "page", value = "当前页码", required = true)
@PathVariable Long page,
@ApiParam(name = "limit", value = "每页记录数", required = true)
@PathVariable Long limit,
@ApiParam(name = "teacherQuery", value = "查询对象", required = false)
@RequestBody TeacherQuery teacherQuery){
Page<EduTeacher> pageParam = new Page<>(page, limit);
eduTeacherService.pageQuery(pageParam, teacherQuery);
List<EduTeacher> records = pageParam.getRecords();
long total = pageParam.getTotal();
return R.ok().data("total", total).data("rows", records);
}
as the picture shows