当前使用版本(必填,否则不予处理)

  <groupId>com.baomidou</groupId>
        <artifactId>mybatis-plus-boot-starter</artifactId>
        <version>3.4.0</version>
    </dependency>

该问题是如何引起的?(确定最新版也有问题再提!!!)

@Table @Data class ExamKtyrygl { private String id; private String ksda; private int examcount; private LocalDateTime answerdatetime; }

ServiceImp { ExamKtyrygl ktyrygl = new ExamKtyrygl(); ktyrygl.setId(id); ktyrygl.setKsda(ksda); ktyrygl.setAnswerdatetime(new Timestamp(Func.toLong(date))); ktyrygl.setAnswerdatetime(LocalDateTime.now()); System.out.println(ktyrygl.getExamcount()); // 0 ktdao.updateById(ktyrygl); // 在业务层执行的sql是 UPDATE WSSAFE.EXAM_KTYRYGL SET ksda=?, answerdatetime=?, examcount=?, xgsj=? WHERE id=? 1. 为什么直接修改了examcount这个值呢?我并没有设置一个值,还是说int的问题?

  2.  LocalDateTime 字段修改设置值报错,类型不正确
nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='et.answerdatetime', mode=IN, javaType=class java.lang.Object, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #2 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #2 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: java.sql.SQLException: 无效的列类型","data":null}

}

重现步骤(如果有就写完整)

@Table @Data class ExamKtyrygl { private String id; private String ksda; private int examcount; private LocalDateTime answerdatetime; }

ServiceImp { ExamKtyrygl ktyrygl = new ExamKtyrygl(); ktyrygl.setId(id); ktyrygl.setKsda(ksda); ktyrygl.setAnswerdatetime(new Timestamp(Func.toLong(date))); ktyrygl.setAnswerdatetime(LocalDateTime.now()); System.out.println(ktyrygl.getExamcount()); // 0 ktdao.updateById(ktyrygl); // 在业务层执行的sql是 UPDATE WSSAFE.EXAM_KTYRYGL SET ksda=?, answerdatetime=?, examcount=?, xgsj=? WHERE id=?

   1. 为什么直接修改了examcount这个值呢?我并没有设置一个值,还是说int的问题?

  2.  LocalDateTime 字段修改设置值报错,类型不正确
nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='et.answerdatetime', mode=IN, javaType=class java.lang.Object, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #2 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #2 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: java.sql.SQLException: 无效的列类型","data":null}

}

报错信息

  1. LocalDateTime 字段修改设置值报错,类型不正确 nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='et.answerdatetime', mode=IN, javaType=class java.lang.Object, jdbcType=null, numericScale=null, resultMapId='null', jdbcTypeName='null', expression='null'}. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #2 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: org.apache.ibatis.type.TypeException: Error setting non null for parameter #2 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: java.sql.SQLException: 无效的列类型","data":null}

Comment From: huayanYu

int 默认0