自定义sql进行查询时,传入多个参数,遇到“org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.reflection.ReflectionException: There is no getter for property named 'userId' in 'class java.lang.Integer'”的问题
查看网上的方法,需要在dao层或者mapper层的方法上添加@Param,如下图,但是还是报错找不到该参数
原因是:导入的Param包不对
错误的包(这个包是自动导入的,如果不注意的话,根本察觉不到):
import org.springframework.data.repository.query.Param;
正确的包:
import org.apache.ibatis.annotations.Param;