From e23a18102e9fd8087a223b24379915d3bb514e4c Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Thu, 30 May 2024 14:07:00 +0800 Subject: [PATCH] QueryStaff --- .../Ghre/Ghre_ExamServices.cs | 38 ++++++++++++++----- .../Ghre/Ghre_QuestionServices.cs | 10 ++++- 2 files changed, 38 insertions(+), 10 deletions(-) diff --git a/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs b/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs index 4ea4a67d..b4832c73 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs @@ -413,39 +413,44 @@ public class Ghre_ExamServices : BaseServices>> QueryStaff(List Ids, string type) { + string sql = @"SELECT A.StaffID, + A.StaffName, + A.StaffNo, + A.Email Mail, + B.DeptName, + C.TitleName, + FORMAT(A.Indate, 'yyyy/MM/dd') Indate + FROM Ghra_Staff A + 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 "; + + sql += $"AND StaffID IN({string.Join(",", Ids)});"; var list = await _ghra_StaffSceneServices.Query(x => Ids.Contains(x.StaffID)); - var data = list.Select(x => new StaffTableData() - { - StaffID = x.StaffID, - StaffNo = x.StaffNo, - StaffName = x.StaffName, - Mail = x.Email - }).ToList(); + + var data = Db.Ado.SqlQuery(sql); + //var data = list.Select(x => new StaffTableData() + //{ + // StaffID = x.StaffID, + // StaffNo = x.StaffNo, + // StaffName = x.StaffName, + // Mail = x.Email + //}).ToList(); return ServiceResult>.OprateSuccess("查询成功!", data); } diff --git a/Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs b/Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs index a7cef59a..37fd396d 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_QuestionServices.cs @@ -1,4 +1,5 @@  +using System.Collections.Generic; using System.Data; using AgileObjects.AgileMapper; using Newtonsoft.Json; @@ -213,7 +214,14 @@ public class Ghre_QuestionServices : BaseServices(sql) .OrderBy(filter.orderBy) - .ToPageListAsync(filter.pageNum, filter.pageSize, totalCount); + .ToPageListAsync(filter.pageNum, filter.pageSize, totalCount); + + data.ForEach(async x => + { + x.DifficultyLevelLabel = await GetParaLabel("DifficultyLevel", x.DifficultyLevel); + x.QuestionTypeLabel = await GetParaLabel("QuestionType", x.QuestionType); + }); + return new ServicePageResult(filter.pageNum, totalCount, filter.pageSize, data); }