Parameter 'PartnerCode' not found. Available parameters are [collection, lis] 报错

逃离我推掉我的手 2022-05-20 10:24 303阅读 0赞

注意: 1.变量时item #{item}中必须填写一样的

  1. 2.collection=“list
  2. <select id="getEmpsByConditionForeach" resultType="com.mybatis.bean.Employee">
  3. select * from tb1_employee where id in
  4. <!--
  5. collection:指定要遍历的集合
  6. List类型的参数会特殊处理在map中,mapkey就叫list
  7. Array数组类型的参数会特殊处理在map中,mapkey就叫array
  8. item:将当前遍历的元素赋值给指定的变量
  9. separator:每个元素之间的分隔符
  10. open:遍历出所有结果拼接一个开始的字符
  11. close:遍历出所有结果拼接一个结束的字符
  12. index:索引。遍历list的时候是索引,item就是当前值
  13. 遍历map的时候,indexkeyitem就是map的值
  14. #{变量名}就能取出变量的值,也就是当前遍历出的元素
  15. -->
  16. <foreach collection="List" item="item" separator="," open="(" close=")" index="index">
  17. #{item}
  18. </foreach>
  19. </select>

发表评论

表情:
评论列表 (有 0 条评论,303人围观)

还没有评论,来说两句吧...

相关阅读