fix 省市地区管理
This commit is contained in:
@@ -91,13 +91,13 @@ namespace Atomx.Data.CacheServices
|
||||
Value = state.Id.ToString()
|
||||
};
|
||||
|
||||
var citysInState = cities.Where(p => p.StateProvinceId == state.Id).ToList();
|
||||
var citysInState = cities.Where(p => p.ParentId == state.Id).ToList();
|
||||
foreach (var city in citysInState)
|
||||
{
|
||||
var cityItem = new KeyValueTree
|
||||
{
|
||||
Label = state.Name,
|
||||
Value = state.Id.ToString()
|
||||
Label = city.Name,
|
||||
Value = city.Id.ToString()
|
||||
};
|
||||
|
||||
cityItem.Children = BuildAreaTree(city.Id, cities, new List<KeyValueTree>());
|
||||
@@ -250,7 +250,7 @@ namespace Atomx.Data.CacheServices
|
||||
private List<KeyValueTree> BuildAreaTree(long parentId, List<Area> areas, List<KeyValueTree> result)
|
||||
{
|
||||
var data = areas.Where(p => p.ParentId == parentId).ToList();
|
||||
foreach (var area in areas)
|
||||
foreach (var area in data)
|
||||
{
|
||||
var item = new KeyValueTree
|
||||
{
|
||||
@@ -261,7 +261,7 @@ namespace Atomx.Data.CacheServices
|
||||
if (childs.Count > 0)
|
||||
{
|
||||
var childrenTrees = BuildAreaTree(area.Id, areas, result);
|
||||
item.Children.AddRange(childrenTrees);
|
||||
item.Children = childrenTrees;
|
||||
}
|
||||
result.Add(item);
|
||||
}
|
||||
|
||||
1528
Atomx.Data/Migrations/20260105102643_0.2.Designer.cs
generated
Normal file
1528
Atomx.Data/Migrations/20260105102643_0.2.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
29
Atomx.Data/Migrations/20260105102643_0.2.cs
Normal file
29
Atomx.Data/Migrations/20260105102643_0.2.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace Atomx.Data.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class _02 : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<int>(
|
||||
name: "Count",
|
||||
table: "Areas",
|
||||
type: "integer",
|
||||
nullable: false,
|
||||
defaultValue: 0);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropColumn(
|
||||
name: "Count",
|
||||
table: "Areas");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -243,6 +243,9 @@ namespace Atomx.Data.Migrations
|
||||
b.Property<bool>("AllowShipping")
|
||||
.HasColumnType("boolean");
|
||||
|
||||
b.Property<int>("Count")
|
||||
.HasColumnType("integer");
|
||||
|
||||
b.Property<long>("CountryId")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user