Skip to content

Instantly share code, notes, and snippets.

@Raouf25
Last active April 16, 2020 17:56
Show Gist options
  • Save Raouf25/ee35ead9d6ecfaee5e8074d338a6837b to your computer and use it in GitHub Desktop.
Save Raouf25/ee35ead9d6ecfaee5e8074d338a6837b to your computer and use it in GitHub Desktop.
@Transactional
@GetMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
@ResponseStatus(HttpStatus.OK)
public ResponseEntity<List<Car>> get(
@And({
@Spec(path = "manufacturer", params = "manufacturer", spec = Like.class),
@Spec(path = "model", params = "model", spec = Like.class),
@Spec(path = "country", params = "country", spec = In.class),
@Spec(path = "type", params = "type", spec = Like.class),
@Spec(path = "createDate", params = "createDate", spec = Equal.class),
@Spec(path = "createDate", params = {"createDateGt", "createDateLt"}, spec = Between.class)
}) Specification<Car> spec,
Sort sort,
@RequestHeader HttpHeaders headers) {
final PagingResponse response = carService.get(spec, headers, sort);
return new ResponseEntity<>(response.getElements(), returnHttpHeaders(response), HttpStatus.OK);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment