怎么在ibatis使用$往in里面传String参数

2025-05-12 00:42:37
推荐回答(1个)
回答1:

第一种:传入参数仅有数组

调用
string[] strValue = new string[] { "1", "2", "3" };
Reader.QueryForList("WebApp_Ibatisnet.dao.GetEmailList_Test", strValue );

第二种:传入参数有数组,且有其他数据

调用
TestIn ti = new TestIn();
ti.Count = 1;
ti.ArrValue = strValue;
return Reader.QueryForList("WebApp_Ibatisnet.dao.GetEmailList_Test3", ti);
实体类:
public class TestIn
{
private int count;
public int Count
{
get { return count; }
set { count = value; }
}
private string[] arrValue;
public string[] ArrValue
{
get { return arrValue; }
set { arrValue = value; }
}
}

第三种:in后面的数据确定,使用string传入

调用
Reader.QueryForList("WebApp_Ibatisnet.dao.GetEmailList_Test2", "1,2,3");