【发布时间】:2020-02-19 06:49:58
【问题描述】:
我正在尝试在 springboot JPA 中使用 nativeQuery
Query(value = "select * from sms.outgoing_message where create_ts between timestamp(?1) and timestamp(?2) and (error_code IN (?3) or (error_code = '0' and error_msg not like '%Opt out%') or (error_code = '1' and (error_msg like '%21211%' or error_msg like '%21612%' or error_msg = 'Mobile number format is wrong')))", nativeQuery = true)
List<OutgoingMessage> getBounceBackPhoneNumbers(LocalDateTime from, LocalDateTime to, List<String> listSoftBounceErrorCodes);
以上查询返回空结果。
当我尝试使用 30008,30005,30007,30003,30006 而不是 ?3 之类的错误代码时,它会给我更多结果
知道可能是什么问题吗?
【问题讨论】:
-
可能有多个记录,您将给定代码绑定到您的查询。或者,可能存在语法问题。
-
我怀疑你的时间戳部分没有正确传递,你能把调用代码放在这里
标签: sql spring-boot jpa