mybatis传入Integer类型的参数,当参数为0是,会被看做空字符串,所以不能空值判断不能用 != ‘’ <if test="param.houseStatus != null and param.houseStatus != '' "> AND h.STATUS = #{param.houseStatus} </if> --当houseStatus类型为Integer,值为0时,不进判断条件,非0时不受影响 --需改为: <if test="param.houseStatus != null "> AND h.STATUS = #{param.houseStatus} </if>