diff --git a/ds-wms-service/DS.Module.Core/Constants/SqlSugarCacheConst.cs b/ds-wms-service/DS.Module.Core/Constants/SqlSugarCacheConst.cs
new file mode 100644
index 00000000..5defde37
--- /dev/null
+++ b/ds-wms-service/DS.Module.Core/Constants/SqlSugarCacheConst.cs
@@ -0,0 +1,29 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DS.Module.Core.Constants
+{
+ ///
+ /// SqlSugar缓存常量
+ ///
+ public class SqlSugarCacheConst
+ {
+ ///
+ /// SqlSugar二级缓存
+ ///
+ public const string SqlSugar = "sys_sqlSugar:";
+
+ ///
+ /// SqlSugar二级缓存港口信息
+ ///
+ public const string Port = "sys_sqlSugar:Port";
+
+ ///
+ /// SqlSugar二级缓存 往来单位信息
+ ///
+ public const string InfoClient = "sys_sqlSugar:InfoClient";
+ }
+}
diff --git a/ds-wms-service/DS.WMS.Core/Code/Method/CodePortService.cs b/ds-wms-service/DS.WMS.Core/Code/Method/CodePortService.cs
index 8dd5a091..0a0ad523 100644
--- a/ds-wms-service/DS.WMS.Core/Code/Method/CodePortService.cs
+++ b/ds-wms-service/DS.WMS.Core/Code/Method/CodePortService.cs
@@ -1,4 +1,5 @@
using DS.Module.Core;
+using DS.Module.Core.Constants;
using DS.Module.Core.Data;
using DS.Module.Core.Extensions;
using DS.Module.SqlSugar;
@@ -108,7 +109,7 @@ public class CodePortService:ICodePortService
var data = req.Adapt();
- var entity = tenantDb.Insertable(data).ExecuteReturnEntity();
+ var entity = tenantDb.Insertable(data).RemoveDataCache(SqlSugarCacheConst.Port).ExecuteReturnEntity();
_sysCacheService.RemoveCache(Sys.Method.SysCacheCategoryEnum.CommonCodePort, "DS8").GetAwaiter().GetResult();
return DataResult.Successed("添加成功!", entity.Id,MultiLanguageConst.DataCreateSuccess);
}
@@ -118,7 +119,7 @@ public class CodePortService:ICodePortService
info = req.Adapt(info);
- tenantDb.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
+ tenantDb.Updateable(info).RemoveDataCache(SqlSugarCacheConst.Port).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
_sysCacheService.RemoveCache(Sys.Method.SysCacheCategoryEnum.CommonCodePort, "DS8").GetAwaiter().GetResult();
return DataResult.Successed("更新成功!",MultiLanguageConst.DataUpdateSuccess);
}
@@ -162,7 +163,7 @@ public class CodePortService:ICodePortService
return DataResult.Failed("存在已导入的港口信息!",MultiLanguageConst.CodePortImportAlready);
}
- tenantDb.Insertable(list).ExecuteCommand();
+ tenantDb.Insertable(list).RemoveDataCache(SqlSugarCacheConst.Port).ExecuteCommand();
_sysCacheService.RemoveCache(Sys.Method.SysCacheCategoryEnum.CommonCodePort, "DS8").GetAwaiter().GetResult();
return DataResult.Successed("引入成功!",MultiLanguageConst.DataImportSuccess);
}
@@ -185,7 +186,7 @@ public class CodePortService:ICodePortService
var list = tenantDb.Queryable().Where(x => req.Ids.Contains(x.Id)).ToList();
if (list.Count > 0)
{
- tenantDb.Deleteable(list).ExecuteCommand();
+ tenantDb.Deleteable(list).RemoveDataCache(SqlSugarCacheConst.Port).ExecuteCommand();
}
_sysCacheService.RemoveCache(Sys.Method.SysCacheCategoryEnum.CommonCodePort, "DS8").GetAwaiter().GetResult();
return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess);
diff --git a/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs b/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs
index 6e30e969..552c5d70 100644
--- a/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs
+++ b/ds-wms-service/DS.WMS.Core/Info/Method/ClientInfoService.cs
@@ -1,4 +1,5 @@
using DS.Module.Core;
+using DS.Module.Core.Constants;
using DS.Module.Core.Data;
using DS.Module.Core.Extensions;
using DS.WMS.Core.Check.Entity;
@@ -74,7 +75,7 @@ public class ClientInfoService : ServiceBase, IClientInfoService
var entity = TenantDb.InsertNav(data).Include(x => x.InvoiceHeaders).ExecuteReturnEntity();
tag.ClientId = entity.Id;
- TenantDb.Insertable(tag).ExecuteCommand();
+ TenantDb.Insertable(tag).RemoveDataCache(SqlSugarCacheConst.InfoClient).ExecuteCommand();
return DataResult.Successed("添加成功!", entity.Id, MultiLanguageConst.DataCreateSuccess);
}
else
@@ -85,7 +86,7 @@ public class ClientInfoService : ServiceBase, IClientInfoService
info = req.Adapt(info);
tag = req.ClientTag.Adapt(tag);
- TenantDb.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).EnableDiffLogEvent().ExecuteCommand();
+ TenantDb.Updateable(info).RemoveDataCache(SqlSugarCacheConst.InfoClient).IgnoreColumns(ignoreAllNullColumns: true).EnableDiffLogEvent().ExecuteCommand();
TenantDb.Updateable(tag).IgnoreColumns(ignoreAllNullColumns: true).EnableDiffLogEvent().ExecuteCommand();
//创建或更新发票抬头
@@ -185,7 +186,7 @@ public class ClientInfoService : ServiceBase, IClientInfoService
//收发货人
await TenantDb.Deleteable().Where(x => req.Ids.Contains(x.ClientId)).ExecuteCommandAsync();
//删除客户信息
- await TenantDb.Deleteable().Where(x => req.Ids.Contains(x.Id)).ExecuteCommandAsync();
+ await TenantDb.Deleteable().RemoveDataCache(SqlSugarCacheConst.InfoClient).Where(x => req.Ids.Contains(x.Id)).ExecuteCommandAsync();
await TenantDb.Ado.CommitTranAsync();
return DataResult.Success;
diff --git a/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs b/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs
index a5d63bd0..c29a273d 100644
--- a/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs
+++ b/ds-wms-service/DS.WMS.Core/Sys/Method/ClientCommonService.cs
@@ -1,4 +1,5 @@
using DS.Module.Core;
+using DS.Module.Core.Constants;
using DS.Module.Core.Data;
using DS.Module.Core.Extensions;
using DS.Module.Core.Log;
@@ -1071,7 +1072,6 @@ public class ClientCommonService : IClientCommonService
.WhereIF(code == "shipagency", (a, b) => b.IsShipAgency == true)
.WhereIF(code == "enterprise", (a, b) => b.IsEnterprise == true)
.WhereIF(!string.IsNullOrEmpty(queryKey), (a, b) => a.CodeName.Contains(queryKey) || a.ShortName.Contains(queryKey))
- .WithCache()
.Select((a, b) => new ClientSelectRes
{
Id = a.Id,
@@ -1080,7 +1080,7 @@ public class ClientCommonService : IClientCommonService
EnShortName = a.EnShortName,
BLContent = a.BLContent,
}
- ).Take(20).ToListAsync();
+ ).Take(20).WithCache(SqlSugarCacheConst.InfoClient).ToListAsync();
return await Task.FromResult(DataResult>.Success("获取数据成功!", data, MultiLanguageConst.DataQuerySuccess));
}
///
diff --git a/ds-wms-service/DS.WMS.Core/Sys/Method/CommonService.cs b/ds-wms-service/DS.WMS.Core/Sys/Method/CommonService.cs
index 4797cf84..57d1bd9a 100644
--- a/ds-wms-service/DS.WMS.Core/Sys/Method/CommonService.cs
+++ b/ds-wms-service/DS.WMS.Core/Sys/Method/CommonService.cs
@@ -23,6 +23,7 @@ using DS.WMS.Core.Info.Dtos;
using NPOI.SS.Formula.Functions;
using DS.WMS.Core.Flow.Dtos;
using Microsoft.Extensions.Logging;
+using DS.Module.Core.Constants;
namespace DS.WMS.Core.Sys.Method;
@@ -1079,9 +1080,9 @@ public class CommonService : ICommonService
var list = await tenantDb.Queryable()
.Where(x => x.Status == StatusEnum.Enable)
.WhereIF(!string.IsNullOrEmpty(queryKey), x => x.PortName.Contains(queryKey) || x.CnName.Contains(queryKey))
- .WithCache()
.Select()
.Take(20)
+ .WithCache(SqlSugarCacheConst.Port)
.ToListAsync();
return await Task.FromResult(DataResult>.Success("获取数据成功!", list));
}