zoukankan      html  css  js  c++  java
  • Caused by: org.apache.ibatis.binding.BindingException: Parameter 'parameter' not found.解决

    Caused by: org.apache.ibatis.binding.BindingException: Parameter 'company' not found. Available parameters are [1, 0, param1, param2]
        at org.apache.ibatis.binding.MapperMethod$ParamMap.get(MapperMethod.java:165)
        at org.apache.ibatis.reflection.wrapper.MapWrapper.get(MapWrapper.java:44)
        at org.apache.ibatis.reflection.MetaObject.getValue(MetaObject.java:116)
        at org.apache.ibatis.executor.BaseExecutor.createCacheKey(BaseExecutor.java:186)
        at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:119)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.apache.ibatis.plugin.Invocation.proceed(Invocation.java:49)
        at com.chinamobile.sias.core.orm.pagination.interceptor.PaginationInterceptor.intercept(PaginationInterceptor.java:90)
        at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:60)
        at com.sun.proxy.$Proxy82.query(Unknown Source)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:108)
        at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:102)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:606)
        at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:358)
        ... 28 more

    项目框架 Spring+Mybatis

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

    List<Workorder> getOrderByCompanyAndOrderType(String company,String orderType);

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

    List<Workorder> getOrderByCompanyAndOrderType(@Param("company")String company,@Param("orderType")String orderType);

    再次运行就Ok了。

  • 相关阅读:
    codevs1044 拦截导弹(最长不下降子序列dp)
    codevs1014 装箱问题(DP)
    codevs1068 乌龟棋(DP)
    angular.extend vs angular.copy
    angular input框点击别处 变成不可输入状态
    angular select框 option空行
    angular ui 路由传参
    setTimeout 传参
    设置请求头信息的不同方式
    vertical-align
  • 原文地址:https://www.cnblogs.com/EnzoDin/p/6423465.html
Copyright © 2011-2022 走看看