mybatis去除多余的and或者or
<if test="(field1!= null and field1!= '') or (field2!= null and field2!= '') or (field3!= null and field3!= '') ">
and(
<trim prefixOverrides="or">
<if test="field1 != null and field1 != '' ">
or t1.field1 like '%'+#{field1 }+'%'
</if>
<if test="field2!= null and field2!= '' ">
or t1.field2 like '%'+#{field2}+'%'
</if>
<if test="field3!= null and field3!= '' ">
or t1.field3 like '%'+#{field3}+'%'
</if>
</trim>
)
</if>