diff --git a/Tiobon.Core.Services/CommonServices.cs b/Tiobon.Core.Services/CommonServices.cs index 7a1c34d6..047a5c20 100644 --- a/Tiobon.Core.Services/CommonServices.cs +++ b/Tiobon.Core.Services/CommonServices.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; +using Mysqlx.Expr; using System.Text.RegularExpressions; namespace Tiobon.Core.Services; @@ -8,10 +9,12 @@ public partial class CommonServices : BaseServices>, ICommon { IHttpContextAccessor _httpContextAccessor; ILogger _logger; - public CommonServices(ILogger logger, IHttpContextAccessor httpContextAccessor) + public ICaching _caching; + public CommonServices(ILogger logger, IHttpContextAccessor httpContextAccessor, ICaching caching = null) { _logger = logger; _httpContextAccessor = httpContextAccessor; + _caching = caching; } #region 获取菜单 @@ -1929,7 +1932,7 @@ public partial class CommonServices : BaseServices>, ICommon if (toolbar != null) toolbar.fnKey = "TBD4YN"; result.DT_Procedure.ExportExcel = "/api/Ghrh_HumanRequest/ExportCompleteExcel"; - + var name2 = await QueryLangValue("F_ResumeMaintenance_0226", "编制内"); var name3 = await QueryLangValue("F_ResumeMaintenance_0227", "编制外"); result.JM_TableColumnT1.TableColumn?.ForEach(x => @@ -1947,12 +1950,14 @@ public partial class CommonServices : BaseServices>, ICommon } }); result.JM_TableColumnT1.TableColumn = result.JM_TableColumnT1.TableColumn.OrderBy(x => x.SortNo).ToList(); - + break; } #endregion + result.DT_PageMutiMsg = await _caching.GetAsync>(param.menuName + "_DT_PageMutiMsg"); + #region 多语返回处理 if (param.menuName == "F_ResumeMaintenance_All" || param.menuName == "F_ResumeMaintenance_Process" || @@ -1986,7 +1991,11 @@ public partial class CommonServices : BaseServices>, ICommon } #endregion - result.DT_PageMutiMsg = Db.Ado.SqlQuery(sqlLang); + if (result.DT_PageMutiMsg is null) + { + result.DT_PageMutiMsg = Db.Ado.SqlQuery(sqlLang); + await _caching.SetAsync(param.menuName + "_DT_PageMutiMsg", result.DT_PageMutiMsg, TimeSpan.FromMinutes(5)); + } return new ServiceResult() { Success = true, Message = "查询成功", Data = result, }; } diff --git a/Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs b/Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs index e91eb199..57517ce8 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs @@ -908,7 +908,24 @@ public class Ghre_QuestionServices : BaseServices x.QuestionContent == questionContent && x.QuestionType == questionType); + if (courseName.IsNullOrEmpty()) + { + comments.Add("课程为必填项!"); + continue; + } + + Ghre_CourseDto course = null; + if (!string.IsNullOrEmpty(courseName)) + { + course = await _ghre_CourseServices.QuerySingleDto(x => x.CourseName == courseName); + if (course is null) + { + comments.Add("课程不存在,请修正!"); + continue; + } + } + + var question = await base.Query(x => x.QuestionContent == questionContent && x.QuestionType == questionType && x.CourseId == course.Id); if (!question.Any()) { @@ -921,14 +938,6 @@ public class Ghre_QuestionServices : BaseServices x.CourseName == courseName); - if (course is null) - comments.Add("课程不存在,请修正!"); - } - var insert = new InsertGhre_QuestionInput() { CourseId = course?.Id,