发现程序报如下异常,此异常为mybatis抛出
org.springframework.jdbc.UncategorizedSQLException: Error setting null for parameter #3 with JdbcType OTHER . Try setting a different JdbcType for this parameter or a different jdbcTypeForNull configuration property. Cause: java.sql.SQLException: 无效的列类型: 1111
; uncategorized SQLException for SQL []; SQL state [99999]; error code [17004]; 无效的列类型: 1111; nested exception is java.sql.SQLException: 无效的列类型: 1111
从错误信息可以看出,是当在设置一个参数为null的值时,无法设置null对应的jdbcType. 也就是说传入一个空值时,mybatis会报这个错,如果在mybatis的mapper中没有对变量设置jdbcType.
经查,果真是mapper中没有写参数的jdbcType
解决方法,指定item的jdbcType,此处item为字符串类型