ibatis.net 循环

if (oReqV[0]["tag"] != null && !string.IsNullOrEmpty(oReqV[0]["tag"].ToString()))
{
string[] str = StringHelps.SplitString(oReqV[0]["tag"].ToString(), ",");
List<string> personList = new List<string>();
foreach(string s in str)
{
personList.Add(string.Format("%{0}%",s));
}
ht.Add("TagList", personList);
}

<isPropertyAvailable property="TagList">
<isNotEmpty property="TagList">
<iterate property="TagList" prepend="AND" open="(" close=")" conjunction="OR">
<![CDATA[Tag LIKE #TagList[]# ]]>
</iterate>
</isNotEmpty>
</isPropertyAvailable>

原文地址:https://www.cnblogs.com/wdkshy/p/10468614.html