1

我有一个查询,我首先检查输入参数(list<string>)是否为空,或者我设置条件以在查询的 where 条件中传递输入参数

前任:

@Query(value = SELECT * FROM employee t WHERE (((:employeeNameList) is  null) or  ((:employeeNameList) is not null and t.emp_name  IN (:employeeNameList) )", nativeQuery = true) 

Page<Employee> findAllData(Pageable pageable, @Param("employeeNameList")List<String> employeeNameList);

当我将空值作为输入传递并出现以下错误时,上述查询失败

错误:运算符不存在:字符变化 = bytea 提示:没有运算符匹配给定的名称和参数类型。您可能需要添加显式类型转换。位置:126"。

当我传递包含一些字符串值的列表时,它工作正常。

4

0 回答 0