private Integer status;
<if test="status !=null and status != '' or status==0">
AND u.status = #{status}</if>
status这个字段如果值为0,那么mybatis会默认status为空,就不会有添加里面的AND 语句了, 所有 在if里面加上
or status ==0 ,就解决了
private Integer status;
<if test="status !=null and status != '' or status==0">
AND u.status = #{status}</if>
status这个字段如果值为0,那么mybatis会默认status为空,就不会有添加里面的AND 语句了, 所有 在if里面加上
or status ==0 ,就解决了