小编Ash*_*rma的帖子

使用 Spring BOOT REST 和 Spring Data JPA 使用 Criteria API 实现复杂的搜索功能

我需要使用Spring Boot RESTSpring Data JPA使用 Criteria API 来实现复杂的搜索功能。我需要提供如下所示的 RPI ,/college?select=*&where=name:DemoCollege并输入[1,2,3]location:LAstaff{firstName:foo, lastName:boo, workExp>10}

Collage 对象有namelocationtype字段和staff列表。它有onetomany关系,Staff所以College可以有一名或多名工作人员。

基于 uri,我需要使用 criteria api 构建查询。

我发现实现该toPredicate()方法非常复杂org.springframework.data.jpa.domain.Specification。有没有这样的例子来处理如此复杂的搜索过滤器?

提前致谢。

criteria-api spring-data-jpa spring-boot spring-rest

2
推荐指数
1
解决办法
2223
查看次数