mybatis的参数一直出错,该怎么解决

<delete id="deleteCar" parameterType="com.myMall.model.Car">
        DELETE FROM car WHERE car_id=#{car_id};
    </delete>
Error updating database.  Cause: org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='car_id', 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).
### The error may exist in sqlmap/Car.xml
### The error may involve car.deleteCar-Inline
### The error occurred while setting parameters
### SQL: DELETE FROM car WHERE car_id='?';
### Cause: org.apache.ibatis.type.TypeException: Could not set parameters for mapping: ParameterMapping{property='car_id', 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).] with root cause
java.sql.SQLException: Parameter index out of range (1 > number of parameters, which is 0).

该怎么解决

参数类型不对,把

parameterType="com.myMall.model.Car"

改成

parameterType="java.lang.String"

这很明显是指类型错误,把parameterType="com.myMall.model.Car"这个去掉就可以了。传参进来时只传car_id。

把parameterType="com.myMall.model.Car"和sql的分号去掉,在接口方法参数前加一个@Param("car")注解,然后SQL里把car_id=#{car_id}改成car_id=#{car.car_id}试一下行不行

//Dao
public int deleteCar(Car car);

//Mapper
<delete id="deleteCar" parameterType="com.myMall.model.Car">
    DELETE FROM car WHERE car_id=#{car_id,jdbcType=VARCHAR}
</delete>

找不到car_id,是不是你Car的类中不是这么命名的?

参数类型错误,你穿进来的是string类型的参数,但是你的parameterType 却写一个 Car 类型,当然报错了,parameterType 应该是 string

com.myMall.model.Car中的car_id是car_id还是carId。

以及,你的dao层是怎么传值的?是deleteCar(Car car)还是deleteCar(String car_id)