判断String是否为空不只是要判断是否为null,还要判断是否为空字符串 <if test="name!=null and name!=''" > and name = #{name} </if> 否则会出现这种情况