在一个对象中有List类型来记录地市信息,在sql语法中需要使用in来便利,在mybatis中的写法如下
<foreach item="item" index="index" collection="areaList" open="(" close=")" separator="," >
#{areaList[${index}]}
</foreach>
其中,areaList为在对象中的属性,index为索引。