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" >