字段为Integer、Debole、Date值为0时,mybatis插入数据库为null。
查了一下发现integer类型的level为0时,居然被当作了‘’(空串)mybatis是这样规定的。
解决方法:
原SQL判断是:
<if test="appId != null and appId !=''">app_id,</if>
修改为:
<if test="appId != null">app_id,</if>
或者:
<if test="appId != null and appId !='' or appId == 0">app_id,</if>