mybatis mapper映射文件 标签

mybatis mapper映射文件 < foreach >标签

collection:遍历的集合参数名称
open:遍历开始前的符号
separator:每个成员之间的分隔符
close:遍历结束后的结尾符号
index:表示集合当前遍历到的下标,通过#{index}获取当前下标
item:用来存放集合当前元素的值,通过#{item名称}获取当前值

<select id = "getABC" requestType = "String">
	select a from table where b in
	<foreach collection="list" open="(" separator="," close=")" index="index" item="item">
            #{item}
     </foreach>
 <select>

猜你喜欢

转载自blog.csdn.net/weixin_42424720/article/details/85163077