两种靠谱方法
第一种
<if test="cond.name != null">
and a.name like concat(concat('%',#{cond.name, jdbcType=VARCHAR}),'%')
</if>
第二种
<if test="cond.name != null and cond.name != ''">
and a.name <if test="!strict"> like '%' ||</if><if test="strict"> = </if>#{cond.name, jdbcType=VARCHAR}<if test="!strict"> || '%' </if>
</if>
stric表示传入参数的属性