Java 使用列表删除数组
我想实现删除列表的端点,如果ID为Java 使用列表删除数组,java,spring,spring-boot,spring-restcontroller,Java,Spring,Spring Boot,Spring Restcontroller,我想实现删除列表的端点,如果ID为 @DeleteMapping("/contracts/remove/{id}") public ResponseEntity<?> remove(@PathVariable Integer id) { contractsTerminalsService.delete(id); return ResponseEntity.noContent().build(); }
@DeleteMapping("/contracts/remove/{id}")
public ResponseEntity<?> remove(@PathVariable Integer id) {
contractsTerminalsService.delete(id);
return ResponseEntity.noContent().build();
}
实现这一点的正确方法是什么?只需使用列表
,您的请求应该是/api/contracts/bulk\u delete/1,5,6
@DeleteMapping("/contracts/bulk_delete/{ids}")
public ResponseEntity<?> remove(@PathVariable List<Integer> ids) {
// Do whatever you want with id
return ResponseEntity.noContent().build();
}
@DeleteMapping(“/contracts/bulk_delete/{ids}”)
公共响应删除(@PathVariable列表ID){
//你想用身份证做什么都行
返回ResponseEntity.noContent().build();
}
有关更多参考信息,请访问这里有一个完整的解决方案
@DeleteMapping("/contracts/bulk_delete/{ids}")
public ResponseEntity<?> remove(@PathVariable List<Integer> ids) {
// Do whatever you want with id
return ResponseEntity.noContent().build();
}