mybatis:Parameter 'list' not found. Available parameters are [templateId, param1, param2, valueList]
2017-10-26 15:37
701 查看
本文转载至http://www.cnblogs.com/baby-lijun/p/5908088.html
我的EsdTemplateSealMapper.java里面定义的接口是这样的
public List<EsdTemplateSeal> getFilteOutSeal(@Param("filterList")List<String> list,@Param("templateId")String templateId);然后我的EsdTemplateSealMapper.xml里面的sql是这样的:
<select id="getFilteOutSeal" resultMap="BASE_RESULT_MAP">
select t.TEMPLATE_ID, t.SEAL_ID, t.SEAL_TYPE, t.DATA_SRC, t.VERSION
from ESD_TEMPLATE_SEAL t
where t.TEMPLATE_ID=#{templateId,jdbcType=VARCHAR}
and t.SEAL_TYPE not in
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
#{0}
</foreach>
</select>
也写过这样的:
<select id="getFilteOutSeal" resultMap="BASE_RESULT_MAP">
select t.TEMPLATE_ID, t.SEAL_ID, t.SEAL_TYPE, t.DATA_SRC, t.VERSION
from ESD_TEMPLATE_SEAL t
where t.TEMPLATE_ID=#{templateId,jdbcType=VARCHAR}
and t.SEAL_TYPE not in
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
#{filterList}
</foreach>
</select>
控制台都报类似:“
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'list' not found. Available parameters are [templateId, param1, param2, valueList]
”的问题,
最终的解决方案是:
<select id="getFilteOutSeal2" parameterType="map" resultMap="BASE_RESULT_MAP">
select t.TEMPLATE_ID, t.SEAL_ID, t.SEAL_TYPE, t.DATA_SRC, t.VERSION
from ESD_TEMPLATE_SEAL t
where t.TEMPLATE_ID=#{id}
and t.SEAL_TYPE not in
<foreach item="item" collection="filterList" separator="," open="(" close=")" index="index">
#{item}
</foreach>
</select>
ps:foreach里面的collection应该放什么东西,错误的理解里面放的是java.util.List,其实这个类型应该是和我们的@Param绑定的参数名一致
我的EsdTemplateSealMapper.java里面定义的接口是这样的
public List<EsdTemplateSeal> getFilteOutSeal(@Param("filterList")List<String> list,@Param("templateId")String templateId);然后我的EsdTemplateSealMapper.xml里面的sql是这样的:
<select id="getFilteOutSeal" resultMap="BASE_RESULT_MAP">
select t.TEMPLATE_ID, t.SEAL_ID, t.SEAL_TYPE, t.DATA_SRC, t.VERSION
from ESD_TEMPLATE_SEAL t
where t.TEMPLATE_ID=#{templateId,jdbcType=VARCHAR}
and t.SEAL_TYPE not in
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
#{0}
</foreach>
</select>
也写过这样的:
<select id="getFilteOutSeal" resultMap="BASE_RESULT_MAP">
select t.TEMPLATE_ID, t.SEAL_ID, t.SEAL_TYPE, t.DATA_SRC, t.VERSION
from ESD_TEMPLATE_SEAL t
where t.TEMPLATE_ID=#{templateId,jdbcType=VARCHAR}
and t.SEAL_TYPE not in
<foreach item="item" collection="list" separator="," open="(" close=")" index="">
#{filterList}
</foreach>
</select>
控制台都报类似:“
org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.binding.BindingException: Parameter 'list' not found. Available parameters are [templateId, param1, param2, valueList]
”的问题,
最终的解决方案是:
<select id="getFilteOutSeal2" parameterType="map" resultMap="BASE_RESULT_MAP">
select t.TEMPLATE_ID, t.SEAL_ID, t.SEAL_TYPE, t.DATA_SRC, t.VERSION
from ESD_TEMPLATE_SEAL t
where t.TEMPLATE_ID=#{id}
and t.SEAL_TYPE not in
<foreach item="item" collection="filterList" separator="," open="(" close=")" index="index">
#{item}
</foreach>
</select>
ps:foreach里面的collection应该放什么东西,错误的理解里面放的是java.util.List,其实这个类型应该是和我们的@Param绑定的参数名一致
相关文章推荐
- mybatis:Parameter 'list' not found. Available parameters are [templateId, param1, param2, valueList]
- mybatis:Parameter 'ids' not found. Available parameters are [templateId, param1, param2, valueList]
- Mybatis:Parameter 'list' not found. Available parameters are [termIds, eventIds, param1, param2]
- mybatis报错 Parameter 'list' not found. Available parameters are [1, 0, param1, param2]
- mybatis. Parameter 'xxxList' not found. Available parameters are [c
- Parameter 'phone' not found. Available parameters are [0, 1, param1, param2]关于mybatis多个参数问题
- Mybatis错误:Parameter 'XXX' not found. Available parameters are [1, 0, param1, param2]
- mybatis 批量增加 Parameter '__frch_item_0' not found. Available parameters are [list]
- Mybatis错误:Parameter 'XXX' not found. Available parameters are [1, 0, param1, param2]
- Mybatis错误:Parameter 'XXX' not found. Available parameters are [1, 0, param1, param2]
- mybatis 批量增加 报异常 Parameter '__frch_item_0' not found. Available parameters are [list]
- MyBatis批量操作报错:Parameter 'xxxList' not found. Available parameters are [list]
- 当在mybatis用到foreach的时候,会报这个错误Parameter '__frch_item_0' not found. Available parameters are [list]会出现的
- MyBatis报错: Parameter '*' not found. Available parameters are [1, 0, param1, param2]
- mybatis错误: Parameter 'XXX' not found. Available parameters are [0, 1,2, param5, param2]
- MyBatis批量操作报错:Parameter 'xxxList' not found. Available parameters are [list]
- mybatis 批量增加 Parameter '__frch_item_0' not found. Available parameters are [list]
- (三)MyBatis学习之多个报错Parameter 'xxxx' not found. Available parameters are [arg1, arg0, param1, param2]
- MyBatis报错 Parameter '0' not found. Available parameters are [arg1, arg0, param1, param2]
- bug记录:Mybatis-error:Parameter 'xxx' not found. Available parameters are [list]