我使用 R2DBC 存储库:
@Repository
public interface StockRepo extends ReactiveCrudRepository<Stock, Long> {
Flux<Stock> searchByArrayValueIgnoreCase(String[] arr);
}
我需要为 postgres 创建自定义查询,例如"select * from stocks where title like any (array['%1%', '%2%', '%3%']);"
我将 String[] arr 发送到存储库;
在我的存储库中:
@Query("select * from stocks where title like any WHAT")
Flux<Stock> searchByArrayValueIgnoreCase(String[] arr);
我需要在查询中写什么而不是“什么”?
我试过@Query("select * from stock where title like any (array[:#{#arr}])") 但收到错误:
org.springframework.dao.InvalidDataAccessApiUsageException: No parameter specified for [__synthetic_0__]] in query [select * from stocks where title like any (array[:__synthetic_0__])]