我试了以下两种不起作用,true和false效果一样的
<if test="isQuit != null and isQuit == true">
AND stage = 7
</if>
和
<if test="isQuit">
AND stage = 7
</if>
最后试了这种成功了
<if test="isQuit != null and 'true'.toString() == isQuit.toString()">
AND stage = 7
</if>
本文分享了在MyBatis中使用ifTest进行条件判断的实战经验,对比了不同表达式的有效性,并最终找到了一个可靠的解决方案。
我试了以下两种不起作用,true和false效果一样的
<if test="isQuit != null and isQuit == true">
AND stage = 7
</if>
和
<if test="isQuit">
AND stage = 7
</if>
最后试了这种成功了
<if test="isQuit != null and 'true'.toString() == isQuit.toString()">
AND stage = 7
</if>
1657
1378

被折叠的 条评论
为什么被折叠?