java 在 PagingAndSortingRepository 中使用自定义过滤器 findBy
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31568519/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
findBy with custom filter in PagingAndSortingRepository
提问by victor
I have an interface extending the PagingAndSortingRepository
我有一个扩展PagingAndSortingRepository的接口
I have a custom find like :
我有一个自定义查找,如:
findJobByNameBySystemIdUserCompanyId(companyId, pageable)
This works fine, now I want to introduce filtering, so I want to search (like) for string in the list.
这很好用,现在我想引入过滤,所以我想在列表中搜索(喜欢)字符串。
How can I achieve that? The search term could be on any field ?
我怎样才能做到这一点?搜索词可以在任何领域?
回答by AntonZ
Please have a look here: http://docs.spring.io/spring-data/jpa/docs/current/reference/html/#jpa.query-methods.query-creation
请看这里:http: //docs.spring.io/spring-data/jpa/docs/current/reference/html/#jpa.query-methods.query-creation
example: findByFirstnameLike(...), findByFirstnameNotLike(...)
示例: findByFirstnameLike(...), findByFirstnameNotLike(...)