springboot+mybatis

zhuxiaoping發表於2024-05-27

前端一直報500,

後端:nested exception is org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='communityId', 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.lang.ClassCastException: class java.lang.Integer cannot be cast to class java.lang.String (java.lang.Integer and java.lang.String are in module java.base of loader 'bootstrap')

解決

<delete id="removeById" parameterType="java.lang.String">
DELETE FROM com_man_community WHERE community_id = #{communityId}
</delete>
java.lang.String改成int
服了