@RequestParam注解是获取静态URL传入的参数
@PathVariable是获取请求路径中的变量作为参数
@GetMapping("update")
public void updateCategory(@RequestParam("id") Long id, @RequestParam("name") String name){
this.categoryService.updateCategory(id,name);
}
@GetMapping("bid/{bid}")
public ResponseEntity<List<Category>> queryByBrandId(@PathVariable("bid") Long bid){
List<Category> lists=this.categoryService.queryByBrandId(bid);
if (CollectionUtils.isEmpty(lists)){
return ResponseEntity.notFound().build();
}
return ResponseEntity.ok(lists);
}