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