ArrayList在ORM中branchId.in(arrayList.toarray())
如下代码
//SELECT * FROM tblRolesFuncRights WHERE RoleID IN (SELECT RoleID FROM tblEmpRoles WHERE EmpID={0} AND DeleteFlag=0) AND FuncID IN (722,723,724,725,726)用到的sql语句
ArrayList tempRoleId = new ArrayList();//声明ArrayList
var tempRoleList = DB.Context.From<Model.tblEmpRoles>()
.Select(a => a.RoleID)
.Where(a => a.EmpID == int.Parse(userId) && a.DeleteFlag == false)
.ToList();//获取需要的值
foreach (var item in tempRoleList)
{
tempRoleId.Add(item.RoleID);//添加到ArrayList中
}
var roleList = DB.Context.From<Model.tblRolesFuncRights>()
.Where(a => a.FuncID.In(722, 723, 724, 725, 726) && a.RoleID.In(tempRoleId.ToArray()))
.ToDataTable();//整个sql语句拼接完成