<if test="sex!=null and sex!=''" >
and p.sex = #{sex}
</if>
当传入sex="0"时,被判断为‘ ’
解决方法:改为
<if test="sex!=null" >
and p.sex = #{sex}
</if>
<if test="sex!=null and sex!=''" >
and p.sex = #{sex}
</if>
当传入sex="0"时,被判断为‘ ’
解决方法:改为
<if test="sex!=null" >
and p.sex = #{sex}
</if>