定义了一个int类型的字段,插入的时候进行判断如果不为空就插入
<if test="investStatus != null and investStatus != ''" > invest_status, </if>
结果发现 invest_status 为1,2都可以正常插入但是为0的时候,不插入数据。
因为mybatis会默认将int类型的字段为0的值转化为空字符串,所以int类型的字段判断是否为空的时候只能使用test="investStatus != null ",
不需要使用后半句为空字符的判断。修改之后即可正常插入0.