mybatis的xml中使用foreach循环拼接(sql中的 in 语法)

其中stateLists是一个字符串数组,也是参数

and state in

<foreach collection="stateLists" separator="," index="index" item="item" open="(" close=")">
#{item}
</foreach>
原文地址:https://www.cnblogs.com/taosheng-yijiu/p/13254623.html