mybatis 映射文件中,if标签判断字符串相等,两种方式:
因为mybatis映射文件,是使用的ognl表达式,所以在判断字符串sex变量是否是字符串Y的时候,
<if test="sex=='Y'.toString()">
<if test = 'sex== "Y"'>
注意:
不能使用
<if test="sex=='Y'">
and 1=1
</if>
3xiaoleilei 2019-05-20 09:34 原文
mybatis 映射文件中,if标签判断字符串相等,两种方式:
因为mybatis映射文件,是使用的ognl表达式,所以在判断字符串sex变量是否是字符串Y的时候,
<if test="sex=='Y'.toString()">
<if test = 'sex== "Y"'>
注意:
不能使用
<if test="sex=='Y'">
and 1=1
</if>