There is no getter for property named ‘user’ in ‘class’问题
可能的原因
1.字段名写错了
2.@Param注解问题
方法只有一个参数时, 如果xml文件中使用#{user.userId}, 则必须添加@Param注解
方法只有一个参数时, 如果xml文件中使用#{userId}, 则不必添加@Param注解
方法有多个参数时, xml文件必须使用#{user.userId}, 不必添加@Param注解
正确写法
写法一
//Mapper.java
import org.apache.ibatis.annotations.Param;
List<SupplierListVo> getSupplierList(@Param("user") User user);
//Mapper.xml
<select id="getSupplierList" resultType="SupplierListVo">
SELECT *
FROM
table
WHERE
userId = #{user.userId}
</select>
写法二
//Mapper.java
List<SupplierListVo> getSupplierList(User user);
//Mapper.xml
<select id="getSupplierList" resultType="SupplierListVo">
SELECT *
FROM
table
WHERE
userId = #{userId}
</select>
写法三
//Mapper.java
List<SupplierListVo> getSupplierList(User user, Form form);
//Mapper.xml
<select id="getSupplierList" resultType="SupplierListVo">
SELECT *
FROM
table
WHERE
userId = #{user.userId}
AND orderNo = #{form.orderNo}
</select>