<if test="status != null and status != ''" >and status = #{status}</if>

当status类型为Integer时,且status不为null时比如Integer类型的0,1, if条件添加不上。因为Integer类型的status不可能为'';注意传入Integer类型的参数时,不要判断 and status != '' 只判断 != null即可。

11-25 08:06