public void TestIn() { try { var lst = new DepartmentDao().GetTopDepartments(10); var userlst = new UserDao().GetUsersByDepartmentIds(lst.Select(item => item.DepartmentId).ToList()); Console.WriteLine(string.Format("总共有{0}条数据符合条件", userlst.Count)); foreach (var user in userlst) { Console.WriteLine(string.Format("name:{0} 部门id:{1}", user.Name, user.DepartmentId)); } } catch (Exception ex) { Console.WriteLine(ex.Message.ToString()); } }