Mybatis 3.2.6
经过尝试,给出三种可靠可用的写法:
select * from person where name like "%"#{name}"%"
select * from person where name like '%'||#{name}||'%'
select * from person where name like '%${name}%'
三种写法对比后,第一种属于预编译SQL,后两种都不是,因此推荐使用第一种写法。
另外
select * from person where name like CONCAT(#{name},'%')
http://blog.51cto.com/lavasoft/1386870
http://blog.csdn.net/mexican_jacky/article/details/53170717