😎修复同步行政区划空对象问题
This commit is contained in:
parent
6a2ad8c850
commit
39d8ed7326
@ -297,6 +297,8 @@ public class SysRegionService : IDynamicApiController, ITransient
|
|||||||
Level = regionLevel0.Level,
|
Level = regionLevel0.Level,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
if (regionLevel0.Children != null)
|
||||||
|
{
|
||||||
foreach (var regionLevel1 in regionLevel0.Children)
|
foreach (var regionLevel1 in regionLevel0.Children)
|
||||||
{
|
{
|
||||||
var region1 = new SysRegion
|
var region1 = new SysRegion
|
||||||
@ -312,6 +314,7 @@ public class SysRegionService : IDynamicApiController, ITransient
|
|||||||
Console.WriteLine($"1 级:{region1.Id} - {region1.Name} 已存在");
|
Console.WriteLine($"1 级:{region1.Id} - {region1.Name} 已存在");
|
||||||
else
|
else
|
||||||
areaList.Add(region1);
|
areaList.Add(region1);
|
||||||
|
if (regionLevel1.Children == null) continue;
|
||||||
foreach (var regionLevel2 in regionLevel1.Children)
|
foreach (var regionLevel2 in regionLevel1.Children)
|
||||||
{
|
{
|
||||||
var region2 = new SysRegion
|
var region2 = new SysRegion
|
||||||
@ -327,6 +330,7 @@ public class SysRegionService : IDynamicApiController, ITransient
|
|||||||
Console.WriteLine($"2 级:{region2.Id} - {region2.Name} 已存在");
|
Console.WriteLine($"2 级:{region2.Id} - {region2.Name} 已存在");
|
||||||
else
|
else
|
||||||
areaList.Add(region2);
|
areaList.Add(region2);
|
||||||
|
if (regionLevel2.Children == null) continue;
|
||||||
foreach (var regionLevel3 in regionLevel2.Children)
|
foreach (var regionLevel3 in regionLevel2.Children)
|
||||||
{
|
{
|
||||||
var region3 = new SysRegion
|
var region3 = new SysRegion
|
||||||
@ -342,6 +346,7 @@ public class SysRegionService : IDynamicApiController, ITransient
|
|||||||
Console.WriteLine($"3 级:{region3.Id} - {region3.Name}");
|
Console.WriteLine($"3 级:{region3.Id} - {region3.Name}");
|
||||||
else
|
else
|
||||||
areaList.Add(region3);
|
areaList.Add(region3);
|
||||||
|
if (regionLevel3.Children == null) continue;
|
||||||
foreach (var regionLevel4 in regionLevel3.Children)
|
foreach (var regionLevel4 in regionLevel3.Children)
|
||||||
{
|
{
|
||||||
var region4 = new SysRegion
|
var region4 = new SysRegion
|
||||||
@ -358,6 +363,7 @@ public class SysRegionService : IDynamicApiController, ITransient
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (code == 0)
|
if (code == 0)
|
||||||
await _sysRegionRep.AsDeleteable().ExecuteCommandAsync();
|
await _sysRegionRep.AsDeleteable().ExecuteCommandAsync();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user