在Controller的一个方法中添加 int a = 10/0; 使调用方法时产生异常。
| @GetMapping(value = “/pageTeacher/{current}/{limit}”)
public R pageListTeacher(@ApiParam(name = “current”, value = “当前页码”, required = true)
@PathVariable Long current,
@ApiParam(name = “limit”, value = “每页记录数”, required = true)
@PathVariable Long limit){
int a = 10/0;
Page
//调用 page() 方法时候,底层封装,把分页所有数据封装到 pageTeacher
eduTeacherService.page(pageTeacher, null);
**long **total = pageTeacher.getTotal();//总记录数<br /> List<EduTeacher> records = pageTeacher.getRecords();//数据的list集合<br /> **return **R.ok().data(**"total"**,total).data(**"rows"**,records);<br />} |
| —- |
在Swagger 中测试上述方法:
得到结果