Как сделать кастомный фильтр по бд в Spring
Сервис
@Service
public class SearchService {
@Autowired
private ItemRepository repo;
public Iterable<Item> listName(String keyword) {
if (keyword != null) {
return repo.search(keyword);
}
return (Iterable<Item>) repo.findAll();
}
}
Репозиторий
public interface ItemRepository extends CrudRepository<Item, Long> {
@Query("select i from Item i where i.price < 500") /* вот у меня есть запрос вместо число применялась любое веденое число в форму */
public Iterable<Item> count(String keyword_count);
}
Как сделать так же как на olx водить цену от и до но это не обязательное поле ?
