錯誤資訊:
nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'type' in 'class java.lang.String'
<select id="gets" resultType="com.pojo.Dw" > SELECT * FROM dw_dw WHERE 1 = 1 <if test="dwtype != null and dwtype != ''"> AND dwtype=#{dwtype,jdbcType=VARCHAR} </if></select>
解決辦法在方法引數前加上註解 @Param("")
public interface DwMapper{ Dw get(String dwtype,String id); //List<Dw> gets(String dwtype); List<Dw> gets(@Param("dwtype")String dwtype); //方法引數前加上註解 @Param("dwtype") //成功}
mybatis3.5.1
springboot2.4
最新評論