I have following controller
MyController.java
@GetMapping("/checklessthan") public Page<User> demo(@Param(value = "age") String age, @Param(value ="page") int page, @Param(value = "size") int size){ Pageable requestedPage = PageRequest.of(page, size); Page<User> user= userRepository.findAllByageLessThan(age, requestedPage); return user; } @GetMapping("/checkgreaterthan") public Page<User> demo(@Param(value = "age") String age, @Param(value ="page") int page, @Param(value = "size") int size){ Pageable requestedPage = PageRequest.of(page, size); Page<User> user= userRepository.findAllByageGreaterThan(age,requestedPage); return user; } @GetMapping("/checkEquals") public Page<User> demo(@Param(value = "age") String age, @Param(value ="page") int page, @Param(value = "size") int size){ Pageable requestedPage = PageRequest.of(page, size); Page<User> user= userRepository.findAllByageEquals(age, requestedPage); return user; } above 3 APIs is to display the age according to it's method like lessThan, greaterThan or equals age. I want to combine all endpoints into single one. so How can I combine above 3 APIs into single API?
https://stackoverflow.com/questions/65557128/hhow-to-filter-multiple-data-within-a-single-api-path January 04, 2021 at 10:51AM
没有评论:
发表评论