diff --git a/Myshipping.Core/Myshipping.Core.xml b/Myshipping.Core/Myshipping.Core.xml index bd806fe0..d7ab1bf0 100644 --- a/Myshipping.Core/Myshipping.Core.xml +++ b/Myshipping.Core/Myshipping.Core.xml @@ -647,6 +647,11 @@ 船名映射 + + + 字典映射 + + 船名映射 @@ -5416,6 +5421,19 @@ + + + 获取字典 + + + + + + 设置字典 + + + + 获取EDI参数 @@ -5784,6 +5802,18 @@ + + + 获取字典缓存 + + + + + + 设置字典参数 + + + 获取EDI参数 @@ -6880,6 +6910,13 @@ + + + 缓存数据 + + + + 字典类型服务 diff --git a/Myshipping.Core/Service/DjyTenantParam/DjyTenantParamService.cs b/Myshipping.Core/Service/DjyTenantParam/DjyTenantParamService.cs index 756a7bf1..8635390c 100644 --- a/Myshipping.Core/Service/DjyTenantParam/DjyTenantParamService.cs +++ b/Myshipping.Core/Service/DjyTenantParam/DjyTenantParamService.cs @@ -22,13 +22,14 @@ namespace Myshipping.Core.Service private readonly SqlSugarRepository _itemrep; private readonly SqlSugarRepository _valuerep; private readonly ILogger _logger; - - public DjyTenantParamService(SqlSugarRepository rep, SqlSugarRepository itemrep, SqlSugarRepository valuerep, ILogger logger) + private readonly ISysCacheService _cache; + public DjyTenantParamService(SqlSugarRepository rep, SqlSugarRepository itemrep, SqlSugarRepository valuerep, ISysCacheService cache, ILogger logger) { _rep = rep; _logger = logger; _itemrep = itemrep; _valuerep = valuerep; + _cache = cache; } @@ -112,6 +113,7 @@ namespace Myshipping.Core.Service { var entity = input.Adapt(); await _itemrep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); + } /// @@ -126,6 +128,7 @@ namespace Myshipping.Core.Service await _valuerep.DeleteAsync(m => m.ItemCode == entity.ItemCode && m.ParaCode == entity.ParaCode); await _itemrep.DeleteAsync(entity); + } @@ -151,6 +154,7 @@ namespace Myshipping.Core.Service { var entity = input.Adapt(); await _valuerep.InsertAsync(entity); + await CacheData(); } @@ -163,6 +167,7 @@ namespace Myshipping.Core.Service { var entity = input.Adapt(); await _valuerep.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync(); + await CacheData(); } /// @@ -176,5 +181,13 @@ namespace Myshipping.Core.Service var entity = await _itemrep.FirstOrDefaultAsync(u => u.Id == Id); await _valuerep.DeleteAsync(entity); } + + + public async Task CacheData() + { + var list = await _valuerep.AsQueryable().ToListAsync(); + + await _cache.SetAllTenantParam(list); + } } } diff --git a/Myshipping.Core/Service/DjyTenantParam/IDjyTenantParamService.cs b/Myshipping.Core/Service/DjyTenantParam/IDjyTenantParamService.cs index 63e1fe8a..a5053375 100644 --- a/Myshipping.Core/Service/DjyTenantParam/IDjyTenantParamService.cs +++ b/Myshipping.Core/Service/DjyTenantParam/IDjyTenantParamService.cs @@ -17,5 +17,7 @@ namespace Myshipping.Core.Service Task UpdateParamItem(DjyTenantParamItem input); Task DeleteParamItem(long Id); + + Task CacheData(); } } \ No newline at end of file diff --git a/Myshipping.Web.Core/Startup.cs b/Myshipping.Web.Core/Startup.cs index 834dd673..6c468f0b 100644 --- a/Myshipping.Web.Core/Startup.cs +++ b/Myshipping.Web.Core/Startup.cs @@ -116,6 +116,9 @@ public class Startup : AppStartup //缓存字典数据 App.GetService().CacheData(); + + //租户参数 + App.GetService().CacheData(); } public void Configure(IApplicationBuilder app, IWebHostEnvironment env)