my requirement is to get the list of entity from the list of ids , I was trying something like this and I when I am priting to string method I am getting the list but when I am trying to return it , It saying not found .
My repo code
List<AddingProductForView> findAllByproductidIn(ArrayList<Integer> productid);
my servicecode:-
public List<AddingProductForView> getListOfData(ArrayList<Integer> productid){
List<AddingProductForView> findAllByProductIdIn = repository.findAllByproductidIn(productid);
return findAllByProductIdIn;
}
mycontrollercode:-
@PostMapping("/getProductsId")
public List<AddingProductForView> getListOfData(@RequestBody ArrayList<Integer> productid) {
List<AddingProductForView> findAllByProductIdIn = fileService.getListOfData(productid);
return findAllByProductIdIn;
}
while priting toString method (getting the result as :-
`[AddingProductForView [productid=1, productname=RO, imagepath=./assets/1.jpeg, price=4000 , productdescription=best], AddingProductForView [productid=2, productname=RO, imagepath=./assets/2.jpeg, price=8000 , productdescription=cheap], AddingProductForView [productid=3, productname=RO, imagepath=./assets/3.jpeg, price=2000 , productdescription=values]]`
What I am trying to hit from postman:-
[1,3,2]
Error:- { "timestamp": "2021-07-02T07:25:50.973+0000", "status": 404, "error": "Not Found", "message": "No message available", "path": "/api/excel/getProductsId" }