<if test="status != null and status != '' or status ==0">
AND status= #{status,jdbcType=INTEGER}
</if>
参数为0时,xml中 status !=''会将0排除了,如果只是判断不等null,0是可以传递过去的
上边的是严谨写法
也可以写成这样:
<if test="status != null">
AND status= #{status,jdbcType=INTEGER}
</if>