用mybatis时遇到一个问题,java代码中传递的整数0在mybatis中被识别成null
<if test="state!=null">
state=#{state}
</if>
这样编写如果state为0时, 则被认为NULL了. 无法执行预期执行的代码!
修改如下:
<if test="state != null or state== 0">
state = #{state}
</if>
<if test="state!=null">
state=#{state}
</if>
这样编写如果state为0时, 则被认为NULL了. 无法执行预期执行的代码!
修改如下:
<if test="state != null or state== 0">
state = #{state}
</if>