@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);
}