考试 发布新增校验关联数据是否存在课件

master
xiaochanghai 4 months ago
parent 0fdce08daa
commit 9d1b93a60b
  1. 31
      Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs
  2. 5
      Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs

@ -1225,6 +1225,22 @@ public class Ghre_ExamServices : BaseServices<Ghre_Exam, Ghre_ExamDto, InsertGhr
if (entity.Status == DIC_EXAM_STATUS.DISABLED && status == DIC_EXAM_STATUS.RELEASED) if (entity.Status == DIC_EXAM_STATUS.DISABLED && status == DIC_EXAM_STATUS.RELEASED)
{ {
#region 判断相关联课件是否存在
var sql = $@"SELECT count(0)
FROM Ghre_CourseWare A
WHERE A.Id IN
(SELECT CourseWareId
FROM Ghre_Course
WHERE (Id = '{entity.CourseId}' OR CourseSceneId = '{entity.CourseSceneId}' OR CourseSceneIds like '%{entity.CourseSceneId}%') AND IsEnable = 1)";
var count = await Db.Ado.GetIntAsync(sql);
if (count == 0)
{
if (entity.LinkType == "CourseId")
return ServiceResult.OprateFailed("该考试关联的课程未维护课件,暂不可取消归档!");
}
#endregion
if (entity.LinkType == "CourseId") if (entity.LinkType == "CourseId")
{ {
var course = await _ghre_CourseServices.QueryById(entity.CourseId); var course = await _ghre_CourseServices.QueryById(entity.CourseId);
@ -1244,6 +1260,21 @@ public class Ghre_ExamServices : BaseServices<Ghre_Exam, Ghre_ExamDto, InsertGhr
if (status == DIC_EXAM_STATUS.RELEASED && entity.Status == DIC_EXAM_STATUS.DRAFT) if (status == DIC_EXAM_STATUS.RELEASED && entity.Status == DIC_EXAM_STATUS.DRAFT)
{ {
#region 判断相关联课件是否存在
var sql = $@"SELECT count(0)
FROM Ghre_CourseWare A
WHERE A.Id IN
(SELECT CourseWareId
FROM Ghre_Course
WHERE (Id = '{entity.CourseId}' OR CourseSceneId = '{entity.CourseSceneId}' OR CourseSceneIds like '%{entity.CourseSceneId}%') AND IsEnable = 1)";
var count = await Db.Ado.GetIntAsync(sql);
if (count == 0)
{
if (entity.LinkType == "CourseId")
return ServiceResult.OprateFailed("该考试关联的课程未维护课件,暂不可发布!");
}
#endregion
var ids1 = ids.Where(x => id != x).ToList(); var ids1 = ids.Where(x => id != x).ToList();
if (entity.LinkType == DIC_EXAM_LINK_TYPE_COURSE) if (entity.LinkType == DIC_EXAM_LINK_TYPE_COURSE)
{ {

@ -911,7 +911,7 @@ public class Ghre_StudyRecordServices : BaseServices<Ghre_StudyRecord, Ghre_Stud
A.ExamDateType, A.ExamDateType,
A.AfterHowLong, A.AfterHowLong,
A.StudyProgress, A.StudyProgress,
A.ExamId,A.ExamStatus,A.CoursePublishTime A.ExamId,A.ExamStatus,A.CoursePublishTime,A.IsRequireStudy
FROM Ghre_StudyRecord_V A"; FROM Ghre_StudyRecord_V A";
string conditions = $" WHERE UserId={App.User.ID} "; string conditions = $" WHERE UserId={App.User.ID} ";
@ -1077,6 +1077,9 @@ public class Ghre_StudyRecordServices : BaseServices<Ghre_StudyRecord, Ghre_Stud
x.StudyProgress = 60; x.StudyProgress = 60;
} }
#endregion #endregion
if (x.IsRequireStudy == false)
x.ShowStudyBtn = false;
}); });
return new ServicePageResult<Ghre_StudyRecordESS>(filter.pageNum, total, filter.pageSize, entitys); return new ServicePageResult<Ghre_StudyRecordESS>(filter.pageNum, total, filter.pageSize, entitys);

Loading…
Cancel
Save