From e2d761506fb018c2a90470fe9d21e82468bb96c6 Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Thu, 1 Aug 2024 10:46:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E8=80=83=E8=AF=95=20?= =?UTF-8?q?=E7=AE=A1=E7=90=86=20=E4=BA=BA=E5=91=98=E6=9F=A5=E7=9C=8B=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=9D=A5=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Extend/DefaultGhre_ExamInput.cs | 2 + .../Ghre/Ghre_ExamServices.cs | 41 +++++++++++++++++-- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/Tiobon.Core.Model/ViewModels/Extend/DefaultGhre_ExamInput.cs b/Tiobon.Core.Model/ViewModels/Extend/DefaultGhre_ExamInput.cs index e633d668..0ca868f4 100644 --- a/Tiobon.Core.Model/ViewModels/Extend/DefaultGhre_ExamInput.cs +++ b/Tiobon.Core.Model/ViewModels/Extend/DefaultGhre_ExamInput.cs @@ -52,4 +52,6 @@ public class StaffTableData public string InDate { get; set; } public string Mail { get; set; } public string DataSource { get; set; } + + public string DataSourceLabel { get; set; } } \ No newline at end of file diff --git a/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs b/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs index 24fea50c..92ecefcf 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs @@ -986,7 +986,7 @@ public class Ghre_ExamServices : BaseServices x.ExamId == Id); + //var staffs = await _ghre_ExamStaffServices.Query(x => x.ExamId == Id); - var ids = staffs.Select(x => Convert.ToInt32(x.StaffId)).ToList(); - var staffTableData = await QueryStaff(ids, null); + //var ids = staffs.Select(x => Convert.ToInt32(x.StaffId)).ToList(); + var staffTableData = await QueryStaff1(Id); pageData.staffTableData = staffTableData.Data; } #endregion @@ -1052,6 +1052,39 @@ public class Ghre_ExamServices : BaseServices>.OprateSuccess("查询成功!", data); } + + + public async Task>> QueryStaff1(long examId) + { + string sql = @$"SELECT D.Id, + D.CreateTime, + A.StaffID, + A.StaffName, + A.StaffNo, + A.Email Mail, + B.DeptName, + C.TitleName, + FORMAT (A.Indate, 'yyyy/MM/dd') Indate, + D.Source DataSource + FROM Ghre_ExamStaff D + LEFT JOIN Ghra_Staff A ON A.StaffID = D.StaffId + LEFT JOIN Ghro_Dept B ON A.DeptID = B.DeptID + LEFT JOIN Ghra_Title C ON A.TitleID = C.TitleID + WHERE 1 = 1 AND A.IsEnable = 1 AND D.ExamId = '{examId}' + ORDER BY D.CreateTime ASC"; + + var data = await Db.Ado.SqlQueryAsync(sql); + data.ForEach(x => + { + if (x.DataSource == "ManualRequired") + x.DataSourceLabel = "手动必修"; + else if (x.DataSource == "StudyRuleRequired") + x.DataSourceLabel = "必修规则"; + }); + + return ServiceResult>.OprateSuccess("查询成功!", data); + } + public async Task> Insert1(long id, DefaultGhre_ExamPageData pageData) { if (pageData.DateType == "ExamDate")