mybatis if判断等于某个字符串

这种写法是错误的:在OGNL的表达式中,'true'会被解析成字符,因为java是强类型的

<if test="flag=='true' ">
AND ho.id = #{id}
</if>

应该这样写:

<if test='flag == "true"'>
AND ho.id = #{id}
</if>

原文地址:https://www.cnblogs.com/ww25/p/12746130.html