diff --git a/src/platform/ZhonTai.Admin/Core/Consts/FilterNames.cs b/src/platform/ZhonTai.Admin/Core/Consts/FilterNames.cs index ac6c5068..d93ba98a 100644 --- a/src/platform/ZhonTai.Admin/Core/Consts/FilterNames.cs +++ b/src/platform/ZhonTai.Admin/Core/Consts/FilterNames.cs @@ -30,4 +30,10 @@ public static partial class FilterNames /// [Description("数据权限")] public const string Data = "Data"; + + /// + /// 会员 + /// + [Description("会员")] + public const string Member = "Member"; } \ No newline at end of file diff --git a/src/platform/ZhonTai.Admin/Core/Db/Data/SyncData.cs b/src/platform/ZhonTai.Admin/Core/Db/Data/SyncData.cs index 29ba6be9..c165d496 100644 --- a/src/platform/ZhonTai.Admin/Core/Db/Data/SyncData.cs +++ b/src/platform/ZhonTai.Admin/Core/Db/Data/SyncData.cs @@ -7,6 +7,7 @@ using FreeSql.DataAnnotations; using ZhonTai.Common.Helpers; using ZhonTai.Admin.Core.Configs; +using ZhonTai.Admin.Core.Consts; namespace ZhonTai.Admin.Core.Db.Data; @@ -56,7 +57,7 @@ protected virtual async Task InitDataAsync( try { - if (await db.Queryable().AnyAsync()) + if (await db.Queryable().DisableGlobalFilter(FilterNames.Tenant, FilterNames.Member).AnyAsync()) { Console.WriteLine($" table: {tableName} record already exists"); return; diff --git a/src/platform/ZhonTai.Admin/Core/Db/DbHelper.cs b/src/platform/ZhonTai.Admin/Core/Db/DbHelper.cs index ad6f59f0..c7317fdc 100644 --- a/src/platform/ZhonTai.Admin/Core/Db/DbHelper.cs +++ b/src/platform/ZhonTai.Admin/Core/Db/DbHelper.cs @@ -466,9 +466,12 @@ HostAppOptions hostAppOptions //租户过滤器 if (appConfig.Tenant) { - fsql.GlobalFilter.ApplyOnlyIf(FilterNames.Tenant, () => user?.Id > 0, a => a.TenantId == user.TenantId); + fsql.GlobalFilter.ApplyOnly(FilterNames.Tenant, a => a.TenantId == user.TenantId); } + //会员过滤器 + fsql.GlobalFilter.ApplyOnly(FilterNames.Member, a => a.MemberId == user.MemberId); + //数据权限过滤器 fsql.GlobalFilter.ApplyOnlyIf(FilterNames.Self, () => diff --git a/src/platform/ZhonTai.Admin/ZhonTai.Admin.xml b/src/platform/ZhonTai.Admin/ZhonTai.Admin.xml index f1c08e2c..f4e7b26a 100644 --- a/src/platform/ZhonTai.Admin/ZhonTai.Admin.xml +++ b/src/platform/ZhonTai.Admin/ZhonTai.Admin.xml @@ -801,6 +801,11 @@ 数据权限 + + + 会员 + + Api分组约定 @@ -1249,6 +1254,11 @@ 创建时间 + + + 修改时间 + + 是否删除