这是调用方法 还有值 这一行执行完直接报错
异常日志
Creating a new SqlSession
Registering transaction synchronization for SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@14dfc5e6]
JDBC Connection [HikariProxyConnection@1610052338 wrapping com.mysql.cj.jdbc.ConnectionImpl@9969437] will be managed by Spring
==> Preparing: INSERT INTO `mediacms`.`t_template`(`name`, `layout`, `rec_num`, `template_type`, `ctime`, `utime`) VALUES ('?', '?', ?, ?, now(), now())
Releasing transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@14dfc5e6]
Transaction synchronization deregistering SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@14dfc5e6]
Transaction synchronization closing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@14dfc5e6]
2020-11-12 11:17:19.097 WARN 6932 --- [nio-9503-exec-1] com.qzx.cms.controller.LayoutController : 添加版面异常:nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='recNum', 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 #3 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 #3 with JdbcType null . Try setting a different JdbcType for this parameter or a different configuration property. Cause: java.sql.SQLException: Parameter index out of range (3 > number of parameters, which is 2).
这是mybatis的代码
<insert id="addTemplate" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
INSERT INTO `mediacms`.`t_template`(`name`, `layout`, `rec_num`, `template_type`, `ctime`, `utime`)
VALUES ('#{name}', '#{layout}', #{recNum}, #{templateType}, now(), now())
</insert>