错误信息:
Could not set parameters for mapping: ParameterMapping{property='goodsImgId', 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 #1 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 (1 > number of parameters, which is 0).
sql语句:
@Insert("INSERT INTO goodsimg(goodsImgId,goodsImgName) VALUE ('#{goodsImgId}','#{goodsImgName}');")
解决方法:
方法一:注释问题,无注释,排除
方法二:添加类型,#{goodsImgId,jdbcType=VARCHAR},无用
方法三:错误原因,手贱给参数添加单引号
正确:@Insert("INSERT INTO goodsimg(goodsImgId,goodsImgName) VALUE (#{goodsImgId},#{goodsImgName});")
错误:@Insert("INSERT INTO goodsimg(goodsImgId,goodsImgName) VALUE ('#{goodsImgId}','#{goodsImgName}');")
ps:正常的sql添加语句时,也要添加单引号,所以之前测试sql语句时,测试不出错误,手贱啊。