异常如下:
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='value', mode=IN, javaType=class java.lang.String, 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).
报在health_service_provider这个模块上的,刚开始很迷,sql并没有写错,报的错也看不大明白,只知道参数设置错误啥的,说是不能设置空参数啥的。
解决方案:删掉xml里面的sql注释。
xml里面不可以有sql的"--"这样子的注释,会报错。如下图:
debug过程:
查了一圈,没有设置错,后来想了下,拉倒吧,可能是其他问题,然后把教案的cv过去,发现也不能跑,后来发现我和教案唯一的区别在于我多了个注释,而且这个注释是以sql的语法注释掉的,这个是xml文件,用sql语法注释没准不可以。所以把注释去掉了,然后就成果了。