一般判断字符串为空时 使用的是和null以及空字符串”进行判断
<if test="str!=null and str!=''">
...
</if>
对于Integer等数值类型
<if test="num!=null">
...
</if>
只需要和空进行判断即可
之前和空字符串也比较了,但是常理来说,0并不等于空字符串,因此等式应该也是成立的,然而在Mybatis里Integer为0时和”比较是相等的,返回的是true.
一般判断字符串为空时 使用的是和null以及空字符串”进行判断
<if test="str!=null and str!=''">
...
</if>
对于Integer等数值类型
<if test="num!=null">
...
</if>
只需要和空进行判断即可
之前和空字符串也比较了,但是常理来说,0并不等于空字符串,因此等式应该也是成立的,然而在Mybatis里Integer为0时和”比较是相等的,返回的是true.