mybatis中if判断Long/Integer类型字段值等于0时不执行条件
mybatis中if条件判断的值为Long/Integer数值类型时,判断条件不能用
<if test="status != null and status != ''">
因为MyBatis的源码中对空传的判断是会先转成 0.0D 所以status != ''也等于0 = 0.0D,结果是true,判断就会进不去。
可以更改条件<if test="status != nulland status != '' or status == 0">
或者删掉条件&...
原创
2021-08-31 11:43:48 ·
1465 阅读 ·
0 评论