> Oracle
SELECT * FROM user WHERE name LIKE CONCAT('%',#{name},'%') 或 SELECT * FROM user WHERE name LIKE '%'||#{name}||'%'
> SQL Server
SELECT * FROM user WHERE name LIKE '%'+#{name}+'%'
> MySQL
SELECT * FROM user WHERE name LIKE CONCAT('%',#{name},'%')
> DB2
SELECT * FROM user WHERE name LIKE CONCAT('%',#{name},'%') 或 SELECT * FROM user WHERE name LIKE '%'||#{name}||'%'
> 通用
SELECT * FROM user WHERE 1 = 1 <if test="name != null and name != ''"> <bind name="pattern" value="'%' + _parameter.name + '%'" /> AND name LIKE #{pattern} </if>