@Test public void del() throws Exception { PartnerSite partnerSite = new PartnerSite(); partnerSite.setName(UUID.randomUUID().toString().substring(0, 4)); partnerSite.setOpen(true); partnerSite.setUrl("https: mapper.insert(partnerSite); PartnerSite lastest = mapper.getLastest(); assertNotNull(lastest.getId()); String token = adminLogin(); mockMvc.perform(delete("/admin/links/del/" + lastest.getId()).header("Authorization", token)).andDo(result -> { JSONObject object = JSONObject.fromObject(result.getResponse().getContentAsString()); assertEquals(SUCCESS.getCode(), object.getInt(Code)); assertTrue(object.getBoolean(Result)); }); long id = lastest.getId(); do { id += 1; } while (mapper.existsById(id)); System.out.println("删除ID=" + id + "的数据"); mockMvc.perform(delete("/admin/links/del/" + id).header("Authorization", token)).andDo(result -> assertEquals(DATA_NOT_EXIST.getCode(), JSONObject.fromObject(result.getResponse().getContentAsString()).getInt(Code)) ); }
@DeleteMapping("/admin/links/del/{id}") public Response del(@PathVariable("id") long id) { return ResponseUtil.success(partnerSiteService.del(id)); }
LinksController { @DeleteMapping("/admin/links/del/{id}") public Response del(@PathVariable("id") long id) { return ResponseUtil.success(partnerSiteService.del(id)); } }
LinksController { @DeleteMapping("/admin/links/del/{id}") public Response del(@PathVariable("id") long id) { return ResponseUtil.success(partnerSiteService.del(id)); }  }
LinksController { @DeleteMapping("/admin/links/del/{id}") public Response del(@PathVariable("id") long id) { return ResponseUtil.success(partnerSiteService.del(id)); }  @PostMapping("/admin/links/create") Response create(@RequestBody LinkReq reqBody); @DeleteMapping("/admin/links/del/{id}") Response del(@PathVariable("id") long id); @PutMapping("/admin/links/update") Response update(@RequestBody LinkReq reqBody); @GetMapping("/links") Response allForOpen(); @GetMapping("/admin/links") Response all(@RequestParam("page") int page,
                        @RequestParam("count") int count); @PostMapping("/apply") Response apply(@RequestParam("name") String name,
                          @RequestParam("url") String url); }
LinksController { @DeleteMapping("/admin/links/del/{id}") public Response del(@PathVariable("id") long id) { return ResponseUtil.success(partnerSiteService.del(id)); }  @PostMapping("/admin/links/create") Response create(@RequestBody LinkReq reqBody); @DeleteMapping("/admin/links/del/{id}") Response del(@PathVariable("id") long id); @PutMapping("/admin/links/update") Response update(@RequestBody LinkReq reqBody); @GetMapping("/links") Response allForOpen(); @GetMapping("/admin/links") Response all(@RequestParam("page") int page,
                        @RequestParam("count") int count); @PostMapping("/apply") Response apply(@RequestParam("name") String name,
                          @RequestParam("url") String url);  }