mybatis中标签 test 判断

mybatis xml 标签test判断

字符串

等于

不能在单引号中写字符串,当使用==的时候,需要test外层使用 ”单引号,里面的参数使用 “”双引号!

<if test='flag != null and flag == "3"'></if>

<if test=" testString != null and testString == 'A'.toString() "></if>
不等于
<if test="formNumber != null and formNumber != ''"></if>

Boolean

等于
<if test='isFuzzyQuery !=null and isFuzzyQuery '></if>

<if test="isFuzzyQuery != null and 'true'.toString() == isFuzzyQuery.toString()"></if>
不等于
<if test="isQuit != null and !isQuit"></if>

<if test="isQuit != null and !isQuit"></if>