From ec5af7989e0ec9ddb0c90de836e737e88429bb45 Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Thu, 16 May 2024 17:55:38 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=9A=E7=94=A8=E6=9F=A5=E8=AF=A2=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E8=A1=A8=E5=8D=95=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=20=E6=96=B0=E5=A2=9EDT=5FPageMutiMsg=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tiobon.Core.Services/BASE/BaseServices.cs | 16 +++++++++------- Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs | 3 +++ 2 files changed, 12 insertions(+), 7 deletions(-) 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)