转载;http://www.blogjava.net/kyleYang/archive/2010/02/02/311688.html
<select id="sql_test" parameterclass="myPramBean" resultclass="myResult">
select *from tablewhere name in
<iterate property="ids" conjunction="," close=")" open="(" />
#ids[]#
</iterate>
and code=#code#
</select>
传入:
myPramBean
{
private String code;
private List ids;
...
}
ibatis传list参数的 用iterate方法。
ibatis中如果
public classs MyBean{
pirvate Long id;
private String name;
.....
}
public class ParamsBean{
private MyBrean myBean;
private Long id;
.........
}
对象中包含对象:
myBean.id ----- myBean.name的方法。