通用查询菜单表单信息接口 新增DT_PageMutiMsg缓存处理

master
xiaochanghai 1 year ago
parent c01727934c
commit ec5af7989e
  1. 14
      Tiobon.Core.Services/BASE/BaseServices.cs
  2. 3
      Tiobon.Core.Services/Ghre/Ghre_CourseServices.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<TEntity, TEntityDto, TInsertDto, TEditDto> : IBaseServ
return Mapper.Map(data).ToANew<List<TEntityDto>>();
}
public async Task<ServiceFormResult> QueryForm(QueryForm body)
{
var result = new ServiceFormResult();
@ -170,7 +168,6 @@ public class BaseServices<TEntity, TEntityDto, TInsertDto, TEditDto> : IBaseServ
result.result.DT_TableDataT1 = Db.Ado.SqlQuery<TEntityDto>(sql);
#region JM_PageFormActionsT1
dynamic JM_PageFormActionsT1 = new ExpandoObject();
@ -266,8 +263,10 @@ public class BaseServices<TEntity, TEntityDto, TInsertDto, TEditDto> : IBaseServ
#endregion
#region DT_PageMutiMsg
var DT_PageMutiMsg = new List<DT_PageMutiMsg>();
sql = $@"SELECT Langkey field,
var DT_PageMutiMsg = await _caching.GetAsync<List<DT_PageMutiMsg>>("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<TEntity, TEntityDto, TInsertDto, TEditDto> : IBaseServ
FROM Ghrs_LangKey
WHERE (LangKey LIKE 'GHR_Page%' OR LangKey LIKE 'GHR_Common%')
AND IsEnable = 1";
DT_PageMutiMsg = Db.Ado.SqlQuery<DT_PageMutiMsg>(sql);
DT_PageMutiMsg = Db.Ado.SqlQuery<DT_PageMutiMsg>(sql);
if (DT_PageMutiMsg.Any())
await _caching.SetAsync("DT_PageMutiMsg", DT_PageMutiMsg, TimeSpan.FromHours(1));
}
#endregion
result.result.JM_PageFormActionsT1 = JM_PageFormActionsT1;

@ -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<Ghre_Course, Ghre_CourseDto, Ins
private readonly IBaseRepository<Ghre_Course> _dal;
private IGhre_CourseClassServices _ghre_CourseClassServices;
public Ghre_CourseServices(IBaseRepository<Ghre_Course> dal,
ICaching caching,
IGhre_CourseClassServices ghre_CourseClassServices)
{
this._dal = dal;
base.BaseDal = dal;
_ghre_CourseClassServices = ghre_CourseClassServices;
base._caching = caching;
}
public override async Task<ServicePageResult<Ghre_CourseDto>> QueryFilterPage(QueryBody body)

Loading…
Cancel
Save