IBatis 构建 In语句
语句
<select id="qryProjectsByIds" parameterClass="Hashtable" resultMap="projectTypeField" >
select *
from Project with(nolock)
where PrjId in
<iterate property="PrjIds" open="(" close=")" conjunction=",">
#PrjIds[]#
</iterate>
</select>
调用
public IList<Project> GetProjectsByIds(string[] idArr)
{
var ht = new Hashtable();
ht.Add("PrjIds", idArr );
var project = mapper.GetList<Project>("qryProjectsByIds", ht);
return project;
}