java - mybatis 3.1.1 分页查询报错nested exception is org.apache.ibatis.binding.BindingException: Parameter '__frch_item_0' not found. Available parameters are [paramMap, param1]
迷茫
迷茫 2017-04-17 11:51:23
0
2
974

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传入的时候就会出现,找了好久,没找到原因

迷茫
迷茫

业精于勤,荒于嬉;行成于思,毁于随。

Antworte allen(2)
刘奇

<if test="params.workAddress!=null and params.workAddress.size()>0 ">
AND
<foreach collection="params.workAddress" index="index" item="item" open="(" separator="or" close=")">

resume.TARGETCITY LIKE #{params.workAddress[${index}]}

</foreach>
</if>
我这样写的 可以了。

迷茫

楼主这个问题解决了吗?我也遇上了。。。

Beliebte Tutorials
Mehr>
Neueste Downloads
Mehr>
Web-Effekte
Quellcode der Website
Website-Materialien
Frontend-Vorlage