Explorar o código

update Admin.NET/Admin.NET.Core/SqlSugar/SqlSugarFilter.cs.
//自定义过滤因子由库缩小到用户,这样在自定义过滤类中就可以做一些涉及部门 用户 等更细的过滤

Signed-off-by: 罗三疯 <mis@kingcan.net>

罗三疯 %!s(int64=2) %!d(string=hai) anos
pai
achega
731c093554
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      Admin.NET/Admin.NET.Core/SqlSugar/SqlSugarFilter.cs

+ 2 - 1
Admin.NET/Admin.NET.Core/SqlSugar/SqlSugarFilter.cs

@@ -133,7 +133,8 @@ public static class SqlSugarFilter
     public static void SetCustomEntityFilter(SqlSugarScopeProvider db)
     {
         // 配置自定义缓存
-        var cacheKey = $"db:{db.CurrentConnectionConfig.ConfigId}:custom";
+        var userId = App.User?.FindFirst(ClaimConst.UserId)?.Value;
+        var cacheKey = $"db:{db.CurrentConnectionConfig.ConfigId}:custom:{userId}";
         var tableFilterItemList = _cache.Get<List<TableFilterItem<object>>>(cacheKey);
         if (tableFilterItemList == null)
         {