1、常用方式
<if test="isCity != null and isCity != ‘’ " >
and is_city = ${isCity}
</if>
2、当传递的值是integer类型且值为0时徐特殊处理,mybatis会把0识别空
处理方法:不使用 !=“” 的判断条件,传低的值为空时在后台处理赋值 -1,判断是判断 != -1;如下
<if test="isCity != null and isCity != -1 " >
and is_city = ${isCity}
</if>