搜尋

首頁  >  問答  >  主體

java - mybatis 3.1.1 分页查询报错nested exception is org.apache.ibatis.binding.BindingException: Parameter '__frch_item_0' not found. Available parameters are [paramMap, param1]

dao接口:

public List<Book> findAsPBookByPage(@Param("paramMap")Map<String,Object> paramMap,RowBounds rowBounds);

XML文件:

<select id="findAsPBookByPage" resultMap="BaseResultMap" parameterType="map">
        SELECT
        <include refid="Base_Column_List" />
        FROM AS_P_Book WHERE 1=1 AND DATA_STATE='1'
        <if test="paramMap.auditStateList !=null and  paramMap.auditStateList.size()>0">
            AND AUDIT_STATE IN
            <foreach item="item" index="index" collection="paramMap.auditStateList" open="(" separator="," close=")">
                #{item,jdbcType=CHAR,javaType=String}
            </foreach>
        </if>
        <if test="paramMap.levelCode !=null and  paramMap.levelCode!=''">
            AND LEVEL_CODE LIKE (#{paramMap.levelCode})
        </if>
        <if test="paramMap.useLevelCode !=null and paramMap.useLevelCode!=''">
            AND USE_LEVEL_CODE LIKE (#{paramMap.useLevelCode})
        </if>
        <if test="paramMap.BookCd !=null and  paramMap.BookCd!=''">
            AND Book_CD = #{paramMap.BookCd}
        </if>

        <if test="paramMap.useType !=null and  paramMap.useType!=''">
            AND USE_TYPE = #{paramMap.useType}
        </if>

        ORDER BY CREATE_TIME DESC
    </select>

错误日志:

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter '__frch_item_0' not found. Available parameters are [paramMap, param1]
    at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:73)
    at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:364)
    at $Proxy27.selectList(Unknown Source)
    at org.mybatis.spring.SqlSessionTemplate.selectList(SqlSessionTemplate.java:201)
    at org.apache.ibatis.binding.MapperMethod.executeForMany(MapperMethod.java:122)
    at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:90)
    at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:40)
    at $Proxy134.findAsPStorageByPage(Unknown Source)
    at com.hsit.dbxt.utils.maintain.service.AsPStorageService.findAsPStorageByPage(AsPStorageService.java:283)
    at com.hsit.dbxt.utils.maintain.service.AsPStorageService$$FastClassByCGLIB$$50cf36e2.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
    at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:698)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
    at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:91)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:631)
    at com.hsit.dbxt.utils.maintain.service.AsPStorageService$$EnhancerByCGLIB$$eebf7051.findAsPStorageByPage(<generated>)
    at com.hsit.dbxt.utils.maintain.web.PhysicalStoreEsb.getDataGridDs(PhysicalStoreEsb.java:341)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at com.rop.impl.AnnotationServiceMethodAdapter.invokeServiceMethod(AnnotationServiceMethodAdapter.java:48)
    at com.rop.impl.AnnotationServletServiceRouter.doService(AnnotationServletServiceRouter.java:655)
    at com.rop.impl.AnnotationServletServiceRouter.access$600(AnnotationServletServiceRouter.java:43)
    at com.rop.impl.AnnotationServletServiceRouter$ServiceRunnable.run(AnnotationServletServiceRouter.java:453)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:417)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
    at java.util.concurrent.FutureTask.run(FutureTask.java:123)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
    at java.lang.Thread.run(Thread.java:595)
Caused by: org.apache.ibatis.binding.BindingException: Parameter '__frch_item_0' not found. Available parameters are [paramMap, param1]
    at org.apache.ibatis.binding.MapperMethod$MapperParamMap.get(MapperMethod.java:262)
    at org.apache.ibatis.reflection.wrapper.MapWrapper.get(MapWrapper.java:40)
    at org.apache.ibatis.reflection.MetaObject.getValue(MetaObject.java:123)
    at org.apache.ibatis.executor.parameter.DefaultParameterHandler.setParameters(DefaultParameterHandler.java:83)
    at com.ridge.dao.mybatis.CountHelper.getCount(CountHelper.java:64)
    at com.ridge.dao.mybatis.PaginationInterceptor.intercept(PaginationInterceptor.java:78)
    at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:57)
    at $Proxy185.prepare(Unknown Source)
    at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:70)
    at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:56)
    at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:267)
    at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:141)
    at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:105)
    at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:81)
    at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:101)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:354)
    ... 30 more

这个错误是当有list传入的时候就会出现,找了好久,没找到原因

迷茫迷茫2770 天前967

全部回覆(2)我來回復

  • 怪我咯

    怪我咯2017-04-17 11:53:23


    AND

    雷雷



    我這樣寫的可以了。

    回覆
    0
  • 迷茫

    迷茫2017-04-17 11:53:23

    樓主這個問題解決了嗎?我也遇上了。 。 。

    回覆
    0
  • 取消回覆