参照这个试试 https://www.cnblogs.com/zblwyj/p/10819084.html
接口里的方法贴出来看下
<foreach collection="list2" item="item" index="index" open="(" close=")" separator=","> ${index}=#{item} </foreach>
这样试试