spring data jpa中@Query中的模糊查询<like关键字>

来源:互联网 发布:淘宝电脑版登录链接 编辑:程序博客网 时间:2024/05/23 13:39
/**
 *
 * @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);
0 1