Mybatis字符串比较
2018-08-01 本文已影响0人
年少时难免轻狂Ho
对于Mybatis中字符串的比较不能直接使用
<if test="errorCount == '0' ">
and ERROR_COUNT = 0
</if>
<if test="errorCount == '1' ">
and ERROR_COUNT > 0
</if>
这样会将'0','1'认为是一个字符,而我们应该使用'0'.toString()
<if test="errorCount == '0'.toString() ">
and ERROR_COUNT = 0
</if>
<if test="errorCount == '1'.toString() ">
and ERROR_COUNT > 0
</if>