我需要使用Spring Boot REST和Spring Data JPA使用 Criteria API 来实现复杂的搜索功能。我需要提供如下所示的 RPI
,/college?select=*&where=name:DemoCollege并输入[1,2,3]location:LAstaff{firstName:foo, lastName:boo, workExp>10}
Collage 对象有name、location、type字段和staff列表。它有onetomany关系,Staff所以College可以有一名或多名工作人员。
基于 uri,我需要使用 criteria api 构建查询。
我发现实现该toPredicate()方法非常复杂org.springframework.data.jpa.domain.Specification。有没有这样的例子来处理如此复杂的搜索过滤器?
提前致谢。