@Test public void page() throws Exception { mockMvc.perform(get("/webUpdate/pages?page=1&count=10")).andDo(result -> { JSONObject object = JSONObject.fromObject(result.getResponse().getContentAsString()); assertEquals(SUCCESS.getCode(), object.getInt(Code)); assertNotNull(object.getJSONObject(Result)); PageInfo pageInfo = (PageInfo) JSONObject.toBean(object.getJSONObject(Result), PageInfo.class); assertNotEquals(0, pageInfo.getEndRow()); assertNotEquals(0, pageInfo.getStartRow()); assertEquals(1, pageInfo.getPageNum()); assertEquals(10, pageInfo.getPageSize()); pageInfo.getList().forEach(o -> { WebUpdateModel model = (WebUpdateModel) JSONObject.toBean(JSONObject.fromObject(o), WebUpdateModel.class); assertNotEquals(0, model.getId()); assertNotNull(model.getTime()); assertNotNull(model.getInfo()); }); }); }
@GetMapping("/webUpdate/pages") public Response page(@RequestParam("page") int page, @RequestParam("count") int count) { return ResponseUtil.success(webUpdateInfoService.pages(count, page)); }
WebUpdateInfoController { @GetMapping("/webUpdate/pages") public Response page(@RequestParam("page") int page, @RequestParam("count") int count) { return ResponseUtil.success(webUpdateInfoService.pages(count, page)); } }
WebUpdateInfoController { @GetMapping("/webUpdate/pages") public Response page(@RequestParam("page") int page, @RequestParam("count") int count) { return ResponseUtil.success(webUpdateInfoService.pages(count, page)); }  }
WebUpdateInfoController { @GetMapping("/webUpdate/pages") public Response page(@RequestParam("page") int page, @RequestParam("count") int count) { return ResponseUtil.success(webUpdateInfoService.pages(count, page)); }  @PostMapping("/admin/webUpdate/create") Response create(@RequestParam("info") String info); @DeleteMapping("/admin/webUpdate/del/{id}") Response del(@PathVariable("id") long id); @PutMapping("/admin/webUpdate/update") Response update(@RequestParam("id") long id, @RequestParam("info") String info); @GetMapping("/webUpdate") Response findAll(); @GetMapping("/webUpdate/pages") Response page(@RequestParam("page") int page, @RequestParam("count") int count); @GetMapping("/lastestUpdateTime") Response lastestUpdateTime(); }
WebUpdateInfoController { @GetMapping("/webUpdate/pages") public Response page(@RequestParam("page") int page, @RequestParam("count") int count) { return ResponseUtil.success(webUpdateInfoService.pages(count, page)); }  @PostMapping("/admin/webUpdate/create") Response create(@RequestParam("info") String info); @DeleteMapping("/admin/webUpdate/del/{id}") Response del(@PathVariable("id") long id); @PutMapping("/admin/webUpdate/update") Response update(@RequestParam("id") long id, @RequestParam("info") String info); @GetMapping("/webUpdate") Response findAll(); @GetMapping("/webUpdate/pages") Response page(@RequestParam("page") int page, @RequestParam("count") int count); @GetMapping("/lastestUpdateTime") Response lastestUpdateTime();  }