From f13f3f636fbf0ec6b1016c5e094e02b78dc8b074 Mon Sep 17 00:00:00 2001 From: xiaochanghai Date: Wed, 31 Jul 2024 16:32:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tiobon.Core.Api/Tiobon.Core.Model.xml | 17 ++-- .../Ghre/Ghre_ExamRecordServices.cs | 88 ++++++++++--------- .../Ghre/Ghre_StudyRuleServices.cs | 2 +- Tiobon.Core/Tiobon.Core.Model.xml | 27 ++++-- 4 files changed, 81 insertions(+), 53 deletions(-) diff --git a/Tiobon.Core.Api/Tiobon.Core.Model.xml b/Tiobon.Core.Api/Tiobon.Core.Model.xml index e91b557e..8953e5b7 100644 --- a/Tiobon.Core.Api/Tiobon.Core.Model.xml +++ b/Tiobon.Core.Api/Tiobon.Core.Model.xml @@ -12592,19 +12592,24 @@ 全局常量 - + - 考试管理-状态-草稿箱 + 考试管理-状态 - + - 考试管理-状态-已发布 + 草稿箱 - + - 考试管理-状态-已归档 + 已发布 + + + + + 已归档 diff --git a/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs b/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs index afcc8715..8d20260d 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_ExamRecordServices.cs @@ -13,6 +13,7 @@ using Tiobon.Core.Common.Helper; using AgileObjects.AgileMapper.Extensions; using SqlSugar; using Tiobon.Core.DataAccess; +using System.Data; namespace Tiobon.Core.Services; @@ -380,42 +381,44 @@ public class Ghre_ExamRecordServices : BaseServices().FirstAsync(x => x.Id == id); - string sql = @$"SELECT A.StaffId, - A.Source, - A.ExamId, - B.Id, - B.LinkType, - B.CourseId, - B.CourseSceneId, - B.ExamPaperId, - B.CoverUrl, - B.ExamNo, - B.ExamName, - B.DateType, - B.BeginTime, - B.EndTime, - B.AfterHowLong, - B.ExamMode, - B.ExamPlace, - B.IsLinkOpenClass, - B.OpenClassId, - B.Status - FROM Ghre_ExamStaff A - JOIN Ghre_Exam B - ON A.ExamId = B.Id - AND B.Status = 'Released' - AND A.IsEnable = B.IsEnable - AND B.CourseId = '{studyRecord.CourseId}' - WHERE A.IsEnable = 1 - AND ( B.DateType = 'AfterHowLong' - OR ( B.DateType = 'ExamDate' - AND B.BeginTime >= GETDATE () - AND B.EndTime <= GETDATE ())) - AND A.StaffId = {studyRecord.StaffId}"; - - var exam = await Db.Ado.SqlQuerySingleAsync(sql); + //string sql = @$"SELECT A.StaffId, + // A.Source, + // A.ExamId, + // B.Id, + // B.LinkType, + // B.CourseId, + // B.CourseSceneId, + // B.ExamPaperId, + // B.CoverUrl, + // B.ExamNo, + // B.ExamName, + // B.DateType, + // B.BeginTime, + // B.EndTime, + // B.AfterHowLong, + // B.ExamMode, + // B.ExamPlace, + // B.IsLinkOpenClass, + // B.OpenClassId, + // B.Status + // FROM Ghre_ExamStaff A + // JOIN Ghre_Exam B + // ON A.ExamId = B.Id + // AND B.Status = 'Released' + // AND A.IsEnable = B.IsEnable + // AND B.CourseId = '{studyRecord.CourseId}' + // WHERE A.IsEnable = 1 + // AND ( B.DateType = 'AfterHowLong' + // OR ( B.DateType = 'ExamDate' + // AND B.BeginTime >= GETDATE () + // AND B.EndTime <= GETDATE ())) + // AND A.StaffId = {studyRecord.StaffId}"; + + var exam = await Db.Queryable() + .Where(x => x.Id == studyRecord.ExamId) + .FirstAsync(x => x.Status == Consts.DicExamStatus.RELEASED); if (exam is null) - return ServiceResult.OprateFailed("该门课程勿需考试!"); + return ServiceResult.OprateFailed("该门课程无需考试!"); var insrt = new InsertGhre_ExamRecordInput() { @@ -427,7 +430,9 @@ public class Ghre_ExamRecordServices : BaseServices() .WhereIF(rule.CourseId != null, x => x.CourseId == rule.CourseId) .WhereIF(rule.CourseSceneId != null, x => x.CourseSceneId == rule.CourseSceneId) - .FirstAsync(x => x.Status == Consts.DIC_EXAM_STATUS_RELEASED); + .FirstAsync(x => x.Status == Consts.DicExamStatus.RELEASED); for (int i = 0; i < staffs.Count; i++) { diff --git a/Tiobon.Core/Tiobon.Core.Model.xml b/Tiobon.Core/Tiobon.Core.Model.xml index e3556aeb..8953e5b7 100644 --- a/Tiobon.Core/Tiobon.Core.Model.xml +++ b/Tiobon.Core/Tiobon.Core.Model.xml @@ -3260,6 +3260,11 @@ 员工ID + + + 员工ID + + 来源 @@ -9021,6 +9026,11 @@ 员工ID + + + 员工ID + + 来源 @@ -12582,19 +12592,24 @@ 全局常量 - + + + 考试管理-状态 + + + - 考试管理-状态-草稿箱 + 草稿箱 - + - 考试管理-状态-已发布 + 已发布 - + - 考试管理-状态-已归档 + 已归档