1、if多条件满足写法用and拼接
<if test="searchText != null and searchText != ''">
2、sql中不等于写法,用<![CDATA[xx <> 3 ]]>这种写法
例如字段xx不等于3:and <![CDATA[xx <> 3 ]]>
3、当MyBatis 判断条件为等于的时候,常量需要加 .toString() 来转换,这种方法是稳定的,推荐使用,比如:
- <if test="newsImage != null and newsImage == '1'.toString()">
- <![CDATA[ and len(newsImage) > 0 ]]>
- </if>