mybatis-if标签


背景:xml文件中使用mybatis的if标签判断指定字符串(写死),equals 和 != 方法都不能正常判断生效。。。

mybatis 使用if 判断字符串示例:
正例1:

<if test="itemCode != null and itemCode !=''  and itemCode !='aaa'.toString()">

正例2:

<if test='itemCode != null and itemCode !=""  and itemCode !="aaa" '>

反例:

<if test="itemCode != null and itemCode !=''  and itemCode !='aaa' ">