Jpa like 查询

Jpa like 查询_第1张图片

@Query查询

@Query(value = " select * from event e "
			+ " where (e.event_title like CONCAT('%',?1,'%')  or ?1 is null) "
			+ " and (to_days(e.register_time)=to_days(?2) or ?2 is null) "
			+ " and e.status = '1' "
			+ " order by e.register_time desc limit ?3,?4 ",nativeQuery = true)
	List findAllList(String eventTitle,Timestamp registerTime,Integer pageNumber,Integer pageSize);

 

示例:

Jpa like 查询_第2张图片

你可能感兴趣的:(java,jpa)