mybatis中 <if></if>標籤中進行判斷時,若是傳入的時字符格式和數字進行判斷須要將數字進行轉譯,不然默認是數字和數字進行比較,這是就會出現參數格式異常
如<if test="department != 0 and department != null" > 中不對0進行轉譯就會出現這個錯誤
能夠將0用「」引發來,外面的「」改編成‘’或者將0變成‘0’.toString(),以下所示:(將0直接以‘’處理就會變成String格式和char格式進行比較,也會出現同類錯誤)
<if test=‘department != 「0」 and department != null’ >
或者
<if test="department != ‘0’.toString() and department != null" >