@Test public void retrieveOneByName() throws Exception { Tag tag = tagMapper.getLastestTag(); assertNotNull(tag.getName()); mockMvc.perform(get("/tag/name/" + tag.getName())).andDo(result -> { JSONObject object = JSONObject.fromObject(result.getResponse().getContentAsString()); assertEquals(SUCCESS.getCode(), object.getInt(Code)); assertNotNull(object.getJSONObject(Result)); Tag t = (Tag) JSONObject.toBean(object.getJSONObject(Result), Tag.class); assertEquals(tag.getName(), t.getName()); assertNotNull(t.getId()); }); }
@GetMapping("/tag/name/{name}") public Response retrieveOneByName(@PathVariable("name") String name) { return ResponseUtil.success(tagService.retrieveOneByName(name)); }
TagController { @GetMapping("/tag/name/{name}") public Response retrieveOneByName(@PathVariable("name") String name) { return ResponseUtil.success(tagService.retrieveOneByName(name)); } }
TagController { @GetMapping("/tag/name/{name}") public Response retrieveOneByName(@PathVariable("name") String name) { return ResponseUtil.success(tagService.retrieveOneByName(name)); }  }
TagController { @GetMapping("/tag/name/{name}") public Response retrieveOneByName(@PathVariable("name") String name) { return ResponseUtil.success(tagService.retrieveOneByName(name)); }  @PostMapping("/admin/tag/create") Response addOne(@RequestParam("name") String name); @DeleteMapping("/admin/tag/del") Response delOne(@RequestParam("id") long id); @PutMapping("/admin/tag/update") Response updateOne(@RequestParam("id") Long id, @RequestParam("name") String name); @GetMapping("/tag/id/{id}") Response retrieveOneById(@PathVariable("id") long id); @GetMapping("/tag/name/{name}") Response retrieveOneByName(@PathVariable("name") String name); @GetMapping("/tags") Response getPage(@RequestParam(required = false, defaultValue = "10", value = "count") int count,
                            @RequestParam(required = false, defaultValue = "1", value = "page") int page); @GetMapping("/tags/nac") Response getTagNameAndCount(); }
TagController { @GetMapping("/tag/name/{name}") public Response retrieveOneByName(@PathVariable("name") String name) { return ResponseUtil.success(tagService.retrieveOneByName(name)); }  @PostMapping("/admin/tag/create") Response addOne(@RequestParam("name") String name); @DeleteMapping("/admin/tag/del") Response delOne(@RequestParam("id") long id); @PutMapping("/admin/tag/update") Response updateOne(@RequestParam("id") Long id, @RequestParam("name") String name); @GetMapping("/tag/id/{id}") Response retrieveOneById(@PathVariable("id") long id); @GetMapping("/tag/name/{name}") Response retrieveOneByName(@PathVariable("name") String name); @GetMapping("/tags") Response getPage(@RequestParam(required = false, defaultValue = "10", value = "count") int count,
                            @RequestParam(required = false, defaultValue = "1", value = "page") int page); @GetMapping("/tags/nac") Response getTagNameAndCount();  }