【发布时间】:2017-10-12 07:58:58
【问题描述】:
基于StoreRepository@Oliver Gierke
如果Store 有一个products 的集合
/api/store?products.name=Sony%20Vaio
Returns Stores that have Sony Viao on its products 好,但所有产品都退回, 我只需要名称为 Sony Viao 的产品。
public interface StoreRepository extends PagingAndSortingRepository<Store, String>,
QueryDslPredicateExecutor<Store>, QuerydslBinderCustomizer<QStore> {
default void customize(QuerydslBindings bindings, QStore store) {
bindings.bind(store.products.any().first((path, value) -> path.equals(value));
}
}
任何帮助将不胜感激!
【问题讨论】:
-
您真的需要自定义QueryDSL 绑定吗?没有
customize方法,您的代码对我有用。可通过on Github 审核示例项目。
标签: spring-data-jpa spring-data-rest querydsl