您的位置:首页 > 其它

mybatis integer 类型0传值问题。

2015-12-03 09:18 323 查看
新手, 接触mybatis 有几个月了,刚开始遇到过
<if test="status!=null and status!=''">
and status = '${status}'
</if>
当我status 传入参数为0的时候(Integer status ),到if 条件时,就不执行,被识别成 ‘’ 了。
以前我的做法是把
and status != '' 这句去掉。昨天又遇到这个问题了,然后就再去百度了一下,还可以这样写:
<if test="status!=null and status!='' or status == 0">
and status = '${status}'
</if>
但是我现在还是不知道为什么 integer 类型的 0 传入后会变成 ‘’,谁知道...求告知...

                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: