Merge pull request '调整初始化租户业务数据Id为空值时自动设置,非空或大于0时按种子设定的Id插入。' (#139) from ko88/Admin.NET.Pro:main into main
Reviewed-on: http://101.43.53.74:3000/Admin.NET/Admin.NET.Pro/pulls/139
This commit is contained in:
commit
d343cd8abf
@ -479,7 +479,9 @@ public static class SqlSugarSetup
|
||||
{
|
||||
foreach (var sd in seedData)
|
||||
{
|
||||
sd.GetType().GetProperty(nameof(EntityBaseId.Id))!.SetValue(sd, ++tenantId);
|
||||
var id = sd.GetType().GetProperty(nameof(EntityBaseId.Id))!.GetValue(sd, null);
|
||||
if (id != null && (id.ToString() == "0" || string.IsNullOrWhiteSpace(id.ToString())))
|
||||
sd.GetType().GetProperty(nameof(EntityBaseId.Id))!.SetValue(sd, ++tenantId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user