使用 Panache 自定义查询 REST 数据

Custom Query REST Data with Panache

我正在使用 REST Data with Panache for JAX RESTful Web Service generation by extending PanacheEntityResource. In Spring land there is query builder mechanism,它允许 Spring 数据存储库根据自定义方法签名的名称和 return 类型生成 SQL 查询。

我正在尝试使用 Panache 实现同样的目标,但目前未成功。

@ResourceProperties(path = "tasks", paged = false)
public interface TaskResource extends PanacheEntityResource<Task, UUID> {

    List<Task> findByOrganizationId(@QueryParam("organizationId") UUID organizationId);
}

我想将组织 ID 作为查询参数传递,这样我的请求将是 http://localhost:8080/tasks?organizationId=1e7e669d-2935-4d6f-8b23-7a2497b0f5b0,而我的响应将是 return 组织 ID 与提供的任务相匹配的任务列表。是否支持此功能?

目前不支持该功能。 有关详细信息,请参阅 https://quarkus.io/guides/rest-data-panache and https://quarkus.io/guides/spring-data-rest