当我尝试调用 JPA 函数时,这条语句出现错误:“:”处或附近的语法错误
public interface BcaTestRepository extends CrudRepository<InBodyBCA, Long> {
@Query(value = "SELECT * FROM in_body_bca bca WHERE person_id = :personId " +
"AND to_timestamp(bca.datetimes::text, 'YYYYMMDDHH24MISS') BETWEEN :startRange AND :endRange",
nativeQuery = true)
List<InBodyBCA> findAllByPersonId(@Param("personId") Long personId,
@Param("startRange") LocalDateTime startRange,
@Param("endRange") LocalDateTime endRange);
但在 PgAdmin 中查询工作正常
SELECT id, to_timestamp(datetimes::text, 'YYYYMMDDHH24MISS') as dt FROM in_body_bca WHERE to_date(datetimes::text, 'YYYYMMDDHH24MISS')
BETWEEN '2018-05-07' AND '2019-05-07' ORDER BY to_date(datetimes::text, 'YYYYMMDDHH24MISS') DESC ;
慕码人8056858
相关分类