`

Mybatis的like模糊查询

 
阅读更多

今天在查询用户信息时需要用到模糊查询,发现mybatis的like查询不能按我们平常的sql方式那样写,查阅资料后才知道mybaits的方式有点特殊,见如下代码:

<selectid="selectByKeywords"parameterType="String"resultType="User">  
  select * from User u where u.name like "%"#{name}"%";  
</select>

 

传参数的方式和其它相同。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics