转载:/www.cnblogs.com/fangyu19900812/p/6046209.html
实例
/**
* 传入n个街道,查询在此街道上的房屋信息
* @param arr
* @return
*/
=========================dao=============================
public List<House> queryByStreetnames(String[] arr);
===================xml=======================
<select id="queryByStreetnames" resultType="House">
select h.*
from street s,house h
where s.id=h.street_id
and s.name in
<foreach collection="array" item="name" separator="," open="(" close=")">
#{name}
</foreach>
</select>
---------------------------------------------
String[] arr={"知春路","中关村大街"};
List<House> queryByStreetnames = dao2.queryByStreetnames(arr);
for (House house : queryByStreetnames) {
System.out.println(house);
}