1. 程式人生 > >mybatis if判斷integer型別注意點

mybatis if判斷integer型別注意點

今天在寫mapper檔案時遇到integer型別引數時判斷不為空,如下

<if test="status != null and status != ''">

    SQL。。。

</if>

當status=0時,if語句沒有執行。

究其原因,原來mybatis預設將integer=0的引數等於‘’空串。