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;
}

posted @ 2016-05-31 15:49  zslm___  阅读(167)  评论(0编辑  收藏  举报