diff --git a/Tiobon.Core.Services/BASE/BaseServices.cs b/Tiobon.Core.Services/BASE/BaseServices.cs index 093c5844..a8e11664 100644 --- a/Tiobon.Core.Services/BASE/BaseServices.cs +++ b/Tiobon.Core.Services/BASE/BaseServices.cs @@ -4,7 +4,6 @@ using System.Linq.Expressions; using AgileObjects.AgileMapper; using Microsoft.AspNetCore.Http; using Newtonsoft.Json.Linq; -using OfficeOpenXml.FormulaParsing.Excel.Functions.Text; using SqlSugar; using Tiobon.Core.Common; using Tiobon.Core.Common.Caches; @@ -127,7 +126,6 @@ public class BaseServices : IBaseServ return Mapper.Map(data).ToANew>(); } - public async Task QueryForm(QueryForm body) { var result = new ServiceFormResult(); @@ -167,9 +165,8 @@ public class BaseServices : IBaseServ UpdateDataInfo FROM {entityType.GetEntityTableName()} a WHERE a.Id = @ID"; - + result.result.DT_TableDataT1 = Db.Ado.SqlQuery(sql); - #region JM_PageFormActionsT1 dynamic JM_PageFormActionsT1 = new ExpandoObject(); @@ -266,8 +263,10 @@ public class BaseServices : IBaseServ #endregion #region DT_PageMutiMsg - var DT_PageMutiMsg = new List(); - sql = $@"SELECT Langkey field, + var DT_PageMutiMsg = await _caching.GetAsync>("DT_PageMutiMsg"); + if (DT_PageMutiMsg == null || (DT_PageMutiMsg != null && !DT_PageMutiMsg.Any())) + { + sql = $@"SELECT Langkey field, CASE {body.langId} WHEN 1 THEN isnull (Value01, LangValue) WHEN 2 THEN isnull (Value02, LangValue) @@ -283,7 +282,10 @@ public class BaseServices : IBaseServ FROM Ghrs_LangKey WHERE (LangKey LIKE 'GHR_Page%' OR LangKey LIKE 'GHR_Common%') AND IsEnable = 1"; - DT_PageMutiMsg = Db.Ado.SqlQuery(sql); + DT_PageMutiMsg = Db.Ado.SqlQuery(sql); + if (DT_PageMutiMsg.Any()) + await _caching.SetAsync("DT_PageMutiMsg", DT_PageMutiMsg, TimeSpan.FromHours(1)); + } #endregion result.result.JM_PageFormActionsT1 = JM_PageFormActionsT1; diff --git a/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs b/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs index 77a1ae5f..65b85604 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs @@ -6,6 +6,7 @@ using Tiobon.Core.IRepository.Base; using Tiobon.Core.Common; using Tiobon.Core.Model; using AgileObjects.AgileMapper; +using Tiobon.Core.Common.Caches; namespace Tiobon.Core.Services; @@ -17,11 +18,13 @@ public class Ghre_CourseServices : BaseServices _dal; private IGhre_CourseClassServices _ghre_CourseClassServices; public Ghre_CourseServices(IBaseRepository dal, + ICaching caching, IGhre_CourseClassServices ghre_CourseClassServices) { this._dal = dal; base.BaseDal = dal; _ghre_CourseClassServices = ghre_CourseClassServices; + base._caching = caching; } public override async Task> QueryFilterPage(QueryBody body)