springboot项目org.apache.ibatis.binding.BindingException: Parameter 'loginId' not found.

项目框架 Spring+Mybatis

dao层原代码,传入两个参数,调用此方法时会报上边的错,提示你传入的参数找不到。

List getOrderByCompanyAndOrderType(String company,String orderType);
解决方法 在参数前加上@Param注解,如果不使用该注解,那么传入的参数只能有一个(以这种传参方式的话)

List getOrderByCompanyAndOrderType(@Param(“company”)String company,@Param(“orderType”)String orderType);
再次运行就Ok了。

另外一个错误:提示dao中的bean找不到
在启动类上添加basepackage

@SpringBootApplication  
@RestController 
@MapperScan(basePackages = "com.rosam.dao")
public class Application {


    public static void main(String[] args) {
         SpringApplication.run(Application.class, args);  

    }

}

猜你喜欢

转载自blog.csdn.net/weixin_38070406/article/details/80756432