记录一次mybatis<if test>字符串比较的坑

第一种解决方法:

<if test="isExpired=='Y'">
and msg.expire_time &lt; now()
</if>
会报NumberFormatException,这样就可以了。

<if test="isExpired=='Y'.toString()">
and msg.expire_time &lt; now()
</if>
第二种解决方法:

<if test=" name=='张三' ">

<if>
这样会有问题,换成

<if test=' name=="张三" '>

<if>

posted @ 2021-06-30 10:17  少林扫地娃  阅读(119)  评论(0)    收藏  举报