從頁面傳參數 is_send= 0 到mapper.xml
傳入的這個參數類型如果不是字符串類型的話
在xml 經過if(test="is_send!=null and is_send !=''") 這樣判斷的話,那么這個0就會是空
if(test="is_send!=null ) 如果去掉and is_send !=''" 這個,那么就會識別成為0
<result column="is_sent" property="isSent" jdbcType="INTEGER" />
以下正確,如果傳0進來會識別成為0:
<if test="data.isSent != null ">
and is_sent=#{data.isSent,jdbcType=INTEGER}
</if>
以下錯誤,如果傳0,就不會進if條件:
<if test="data.isSent != null and data.isSent!='' ">
and is_sent=#{data.isSent,jdbcType=INTEGER}
</if>