![](/img/trans.png)
[英]What is the best way to implement a REST service that query the database using like statement using Spring Boot and JPA?
[英]Not Equals Query on Spring Boot REST/JPA Service
I'm brand new to Spring Boot, and I've created a very basic REST service that uses JPA, and exposes the RepositoryRestResource for CRUD and query operations on my model:
@RepositoryRestResource
public interface CatalogueOrderRepository extends JpaRepository<CatalogueOrder, Long>,
QuerydslPredicateExecutor<CatalogueOrder> {
}
使用它,我可以执行涉及搜索值、分页和排序的查询,例如:
?page=0&size=5&sort=priority,desc&orderStatus=submitted
是否可以在不进行任何额外工作的情况下搜索不相等的值? 例如,所有 orderStatus 不等于“已提交”的订单。
我注意到Predicate
接口有一个not()
方法,但我不确定它是否相关。
您可以尝试“从方法名称创建查询”。
假设您要按提交的订单状态 <> 搜索订单,
List<Order> findByOrderstatusNot(String orderstatus);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.