Mybatis xml文件中关于处理in操作的List取值

关于foreach标签的问题

<select id="foreachDemo" resultType="com.po.demo" parameterType=
"List">
    select * from user where uid in
    <foreach item="item" index="index" collection="list"
    open="(" separator="," close=")">
        # {item}
    </foreach>
</select>

参数解释

1.item 为list中的数据
2.index 为list中数据的索引
3.open 和 close 必须要配置 才能解释为"()"操作 否则报错
posted @ 2022-05-26 10:45  ewindstorm  阅读(685)  评论(0)    收藏  举报