Mybatis遍历数组、List和Map |
您所在的位置:网站首页 › mybatis遍历string数组 › Mybatis遍历数组、List和Map |
foreach元素的用法 foreach元素的属性主要有 item,index,collection,open,separator,close。 item:表示集合中每一个元素进行迭代时的别名 index:指定一个名字,用于表示在迭代过程中,每次迭代到的位置 collection:表示要进行遍历的元素(数组、集合等) open:表示以什么开始 separator:表示在每次进行迭代之间以什么符号作为分隔符 close:表示以什么结束1、遍历数组 String[] fileIds = {"a12","b34","c56"}; delete from 表名 where id in #{item}2、遍历List List idList= new ArrayList(); idList.add("aa"); idList.add("bb"); idList.add("cc"); select * from 表名 where id in #{item}**3、遍历Map Map updateMap = new HashMap(); updateMap.put("id","编号"); updateMap.put("name","姓名"); updateMap.put("age","年龄"); update 表名 set ${key} = #{_parameter[${key}]} |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |