@Test public void del() throws Exception { WebUpdate webUpdate = new WebUpdate(); webUpdate.setUpdateInfo(UUID.randomUUID().toString()); webUpdate.setUpdateTime(new Date()); mapper.insert(webUpdate); List<WebUpdate> updateList = mapper.findAll(); WebUpdate update = updateList.get(updateList.size() - 1); assertNotEquals(0, update.getId()); long id = update.getId(); mockMvc.perform(delete("/admin/webUpdate/del/" + id).header("Authorization", adminLogin())).andDo(result -> { assertEquals(SUCCESS.getCode(), JSONObject.fromObject(result.getResponse().getContentAsString()).getInt(Code)); assertTrue(JSONObject.fromObject(result.getResponse().getContentAsString()).getBoolean(Result)); }); do { id += 2; } while (mapper.existsById(id)); System.out.println("准备删除ID=" + id + "的不存在记录"); mockMvc.perform(delete("/admin/webUpdate/del/" + id).header("Authorization", adminLogin())).andDo(result -> assertEquals(DATA_NOT_EXIST.getCode(), JSONObject.fromObject(result.getResponse().getContentAsString()).getInt(Code)) ); }
@DeleteMapping("/admin/webUpdate/del/{id}") public Response del(@PathVariable("id") long id) { return ResponseUtil.success(webUpdateInfoService.del(id)); }
WebUpdateInfoController { @DeleteMapping("/admin/webUpdate/del/{id}") public Response del(@PathVariable("id") long id) { return ResponseUtil.success(webUpdateInfoService.del(id)); } }
WebUpdateInfoController { @DeleteMapping("/admin/webUpdate/del/{id}") public Response del(@PathVariable("id") long id) { return ResponseUtil.success(webUpdateInfoService.del(id)); }  }
WebUpdateInfoController { @DeleteMapping("/admin/webUpdate/del/{id}") public Response del(@PathVariable("id") long id) { return ResponseUtil.success(webUpdateInfoService.del(id)); }  @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 { @DeleteMapping("/admin/webUpdate/del/{id}") public Response del(@PathVariable("id") long id) { return ResponseUtil.success(webUpdateInfoService.del(id)); }  @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();  }