mysql :LIKE CONCAT(‘%’,#{empname},’%’ ) 或者 LIKE
CONCAT(‘%’,‘${empname}’,’%’oracle:LIKE ‘%’||#{empname}||’%’
如果是单个的参数(strig。int 。。等)遇到需要判断的时候需要注意写成test=”_parameter!= null”这样。而不是string!=null
<select id="list" resultMap="empMap" parameterType="string">
SELECT * from emps
<where>
<if test="_parameter!= null">
and ename like concat('%',#{name},'%')
</if>
</where>
</select>