Now I have a class User, I get a request data of an array
from the jsp
or html
.
list this Integer[] arr=[5,6,9,10,62,52,21]
Thanks rayrayj92 for the solution. You don't need to write any custom query, just get a list of Objects and delete all objects by that list.
@DeleteMapping("/deleteproduct")
public ResponseEntity> deleteProduct(@Valid @RequestBody Map userMap){
List idList=(List) userMap.get("id_list");
List productList=(List) productRepository.findAllById(idList);
productRepository.deleteAll(productList);
return ResponseEntity.status(HttpStatus.OK).body("Deleted item : "+productList);
}