spring data jpa 查询

原生sql语句查询

1) 模糊查询

public interface DeviceRepository extends JpaRepository<Device, Long>, JpaSpecificationExecutor<Device> {
@Query(value = "select * from biz_device where create_time like CONCAT('%',:time,'%') order by ?#{#pageable}", nativeQuery = true) Page<Device> findByCreateTimeLike(@Param("time")String time, Pageable pageable);
   }
原文地址:https://www.cnblogs.com/guo-rong/p/9635725.html