Hashtable Param = new Hashtable();
List<string> List = new List<string>();
List.Add("f2fa15cf-0cad-44e0-85f1-6c62de72dbcb");
List.Add("b1138425-79db-4b74-b28d-53b07e607ae9");
Param.Add("list", List);
Param.Add("column", "id");
<select id="GetList" resultMap="" parameterClass="Hashtable" >
select
id,Name
from SYS_TALBE
where $column$ in
<iterate property="list" conjunction="," open="(" close=")">
#list[]#
</iterate>
</select>
注:list类型 必须在循环的属性加 property="list" 也就是list的名字,不然循环遍历会索引溢出!(1个的时候会溢出,2个的时候正常,3个的时候就只会遍历2次)
注:字段名动态,必须用 美元符号,值用井号,不然拼接起来就是 where 'id'='11111' 这个语句在sql是不允许的