This commit is contained in:
2021-04-30 11:35:26 +08:00

View File

@@ -37,10 +37,20 @@ namespace Ewide.Core
[Comment("排序")]
public int Sort { get; set; }
/// <summary>
/// 父节点就是去掉后面两位
/// </summary>
public string ParentCode => LevelType>1?Code[0..(Code.Length-2)]:string.Empty;
public string ParentCode => LevelType switch
{
// 市级 => 没有父级 3302
1 => string.Empty,
// 区级 => 6位取4位得到市级 330201
2 => Code[0..(Code.Length - 2)],
// 其他 => 去除后3位得到上级 330201001
_ => Code[0..(Code.Length - 3)],
};
/// <summary>
/// 多个区域有多个用户绑定自定义数据
/// </summary>