1. 程式人生 > >mybatis傳入引數為string型別時,if標籤判斷引數值的方法

mybatis傳入引數為string型別時,if標籤判斷引數值的方法

我們在用mybatis框架時,當傳入的值為string型別時且需要判斷時,如果用和引數為map型別的值一樣的方法來寫<if test="引數名!=null and ''!=引數名“>這時查詢時會報錯:There is no getter for property named '引數名' in 'class java.lang.String'找不到引數名。想要繼續判斷則需要用 "_parameter"來代替引數名:<if test="_parameter!=null and ''!=_parameter“>這樣就可以了;轉自duankelin部落格