public ResponseEntity<Optional> getData(@RequestBody RequestModel requestModel) { try { List mango = new ArrayList();
mangoRepository.findByMangoTag(
requestModel.getMangoTag(),
requestModel.getMangoProduct(),
requestModel.getSellerType()).forEach(mango::add);
Optional<Mango> res = mango.stream().findFirst();
if (!res.isPresent()) {
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
}
return new ResponseEntity<>(res, HttpStatus.OK);
} catch (Exception e) {
return new ResponseEntity<>(null, HttpStatus.INTERNAL_SERVER_ERROR);
}