spring data jpa 原生查询(查一个json中的某一字段)

时间:2023-03-09 16:54:48
spring data jpa  原生查询(查一个json中的某一字段)

数据库:

spring data jpa  原生查询(查一个json中的某一字段)

jpa 查询 java:

 @Component("ediHistoryDAO")
public interface EdiHistoryDAO extends CrudRepository<EdiHistoryDO, Integer>{ EdiHistoryDO findById(BigInteger id); EdiHistoryDO findByEdiInfoId(BigInteger id); List<EdiHistoryDO> findByIdIn(List<BigInteger> id); @Query(value="select * from EDI.edi_history where json_contains(response_summary, ?1) and json_contains(response_summary, ?2) and json_contains(response_summary, ?3) and json_contains(response_summary, ?4)", nativeQuery = true)
public List<EdiHistoryDO> findByResponseSummary(String result,String orderNo,String orderId,String docType);
}

spring data jpa  原生查询(查一个json中的某一字段)