天天看點

spring data jpa中@Query中的模糊查詢<like關鍵字>

版權聲明:本文為部落客原創文章,未經部落客允許不得轉載。 https://blog.csdn.net/tomnic_ylwang/article/details/47340799

/**

 *

 * @author: WYL

 * @createTime: 2015年7月3日 上午10:14:31

 * @history:

 * @param keyName 進行比對的關鍵字

 * @return SearchKey

 */

 @Query(value="select * from search_key a where a.key_name like CONCAT('%',:keyName,'%') limit 1",nativeQuery=true)

 List<SearchKey> findByKeyNameLimit(@Param("keyName") String keyName);