var list = (from province in db.Areas where province.ParentId == 0 && province.IsDel == 0 join city in db.Areas on province.ID equals city.ParentId into citys from ci in citys.DefaultIfEmpty() join area in db.Areas on ci.ID equals area.ParentId into areas select new { ID = province.ID, Name = province.AreaName, FullName = province.FullName, Child = (from cy in citys where cy.IsDel == 0 select new { ID = cy.ID, Name = cy.AreaName, FullName = cy.FullName, Child = (from ar in areas where ar.IsDel == 0 select new { ID = ar.ID, Name = ar.AreaName, FullName = ar.FullName, }) }) }).ToList(); return list;
时间: 2025-01-20 01:45:23