mybatis bug

The if tag judges the empty string and the number 0 to be equal, subverting cognition! ! !


<if test="a==''">
</if>
上面代码等价于
<if test="a==0">
</if>

In the project, it is judged that a parameter of Integer type is not equal to null and not equal to an empty string, and then the filter condition of this parameter will be added. The result parameter is passed to 0. The SQL of the console actually prints the filter condition of this parameter, proving mybatis By default, the 0 of Integer and the empty string are judged to be equal, which is really buggy

Guess you like

Origin blog.csdn.net/weixin_44892460/article/details/109800401