xf 2 years ago
parent
commit
20eab41176

+ 3 - 19
src/Hotline.Application/Systems/TableAccessLevelInitialService.cs

@@ -3,6 +3,7 @@ using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using Hotline.Caches;
 using Hotline.CallCenter.BlackLists;
 using Hotline.Settings;
 using Microsoft.Extensions.DependencyInjection;
@@ -29,25 +30,8 @@ namespace Hotline.Application.Systems
         protected override async Task ExecuteAsync(CancellationToken stoppingToken)
         {
             using var scope = _serviceScopeFactory.CreateScope();
-            var repository = scope.ServiceProvider.GetRequiredService<ITableAccessLevelRepository>();
-            var cache = scope.ServiceProvider.GetRequiredService<ITypedCache<IReadOnlyList<TableAccessLevel>>>();
-            //var accesses = repository.Queryable()
-            //    .Select()
-
-            /*
-             * db.Queryable<Order>().Select(it => new
-            {
-                index2 = SqlFunc.RowNumber(it.Id,it.Name),//order by id partition by name
-                //多字段排序  order by id asc ,name desc
-                //SqlFunc.RowNumber($"{it.Id} asc ,{it.Name} desc ",$"{it.Name}")
-                price=it.Price,
-                date=it.CreateTime
-            })
-            .MergeTable()//将结果合并成一个表
-            .Where(it=>it.index2==1) 
-            //前10条用Where(it=>it.index2=<=20) 
-           .ToList();
-             */
+            var cache = scope.ServiceProvider.GetRequiredService<ITableAccessLevelCacheManager>();
+            cache.Reload();
         }
     }
 }

+ 2 - 1
src/Hotline.CacheManager/TableAccessLevelCacheManager.cs

@@ -6,10 +6,11 @@ using System.Threading.Tasks;
 using Hotline.Caches;
 using Hotline.Settings;
 using XF.Domain.Cache;
+using XF.Domain.Dependency;
 
 namespace Hotline.CacheManager
 {
-    internal class TableAccessLevelCacheManager : ITableAccessLevelCacheManager
+    internal class TableAccessLevelCacheManager : ITableAccessLevelCacheManager, IScopeDependency
     {
         private const string TableAccessLevelCacheKey = "TableAccessLevel";
         private readonly ITypedCache<IReadOnlyList<TableAccessLevelCacheItem>> _cache;

+ 1 - 1
src/Hotline.Repository.SqlSugar/Extensions/SqlSugarStartupExtensions.cs

@@ -172,7 +172,7 @@ namespace Hotline.Repository.SqlSugar.Extensions
             /***写AOP等方法***/
             db.Aop.OnLogExecuting = (sql, pars) =>
             {
-                Log.Information(sql);
+                //Log.Information(sql);
             };
             db.Aop.OnError = (exp) =>//SQL报错
             {