错误写法
<if test=“type==‘error’ ”>
and status = 0
</if>
正确写法
<if test=' type=="true" '>
and status = 0
</if>
mybatis是使用的OGNL表达式来进行解析的,在OGNL的表达式中,'error'会被解析成字符,因为java是强类型的,char 和 一个string 会导致不等。所以if标签中的sql不会被解析。具体的请参照 OGNL 表达式的语法。
错误写法
<if test=“type==‘error’ ”>
and status = 0
</if>
正确写法
<if test=' type=="true" '>
and status = 0
</if>
mybatis是使用的OGNL表达式来进行解析的,在OGNL的表达式中,'error'会被解析成字符,因为java是强类型的,char 和 一个string 会导致不等。所以if标签中的sql不会被解析。具体的请参照 OGNL 表达式的语法。