记录一次mybatis<if test>字符串比较的坑
第一种解决方法:
<if test="isExpired=='Y'">
and msg.expire_time < now()
</if>
会报NumberFormatException,这样就可以了。
<if test="isExpired=='Y'.toString()">
and msg.expire_time < now()
</if>
第二种解决方法:
<if test=" name=='张三' ">
<if>
这样会有问题,换成
<if test=' name=="张三" '>
<if>
浙公网安备 33010602011771号