MyBatis之动态SQL
动态SQL之foreach
- 有时SQL语句where条件是在一个集合或者数组里,需要使用in关键字,这时可以使用foreach动态SQL语句,例如:
select * from person where id in <foreach collection="array" item="id" index="i" open="(" close=")" separator=","> #{id} </foreach>
select * from person where id in
<foreach collection="array" item="id" index="i" open="(" close=")" separator=",">
#{id}
</foreach>