xiaochanghai 4 months ago
parent e892c1d126
commit fbf5447558
  1. 31
      Tiobon.Core.Services/Ghre/Ghre_ExamServices.cs

@ -1227,17 +1227,20 @@ public class Ghre_ExamServices : BaseServices<Ghre_Exam, Ghre_ExamDto, InsertGhr
{ {
#region 判断相关联课件是否存在 #region 判断相关联课件是否存在
var sql = $@"SELECT count(0) if (entity.IsRequireStudy == true)
{
var sql = $@"SELECT count(0)
FROM Ghre_CourseWare A FROM Ghre_CourseWare A
WHERE A.Id IN WHERE A.Id IN
(SELECT CourseWareId (SELECT CourseWareId
FROM Ghre_Course FROM Ghre_Course
WHERE (Id = '{entity.CourseId}' OR CourseSceneId = '{entity.CourseSceneId}' OR CourseSceneIds like '%{entity.CourseSceneId}%') AND IsEnable = 1)"; WHERE (Id = '{entity.CourseId}' OR CourseSceneId = '{entity.CourseSceneId}' OR CourseSceneIds like '%{entity.CourseSceneId}%') AND IsEnable = 1)";
var count = await Db.Ado.GetIntAsync(sql); var count = await Db.Ado.GetIntAsync(sql);
if (count == 0) if (count == 0)
{ {
if (entity.LinkType == "CourseId") if (entity.LinkType == "CourseId")
return ServiceResult.OprateFailed("该考试关联的课程未维护课件,暂不可取消归档!"); return ServiceResult.OprateFailed("该考试关联的课程未维护课件,暂不可取消归档!");
}
} }
#endregion #endregion
@ -1262,19 +1265,23 @@ public class Ghre_ExamServices : BaseServices<Ghre_Exam, Ghre_ExamDto, InsertGhr
{ {
#region 判断相关联课件是否存在 #region 判断相关联课件是否存在
var sql = $@"SELECT count(0) if (entity.IsRequireStudy == true)
{
var sql = $@"SELECT count(0)
FROM Ghre_CourseWare A FROM Ghre_CourseWare A
WHERE A.Id IN WHERE A.Id IN
(SELECT CourseWareId (SELECT CourseWareId
FROM Ghre_Course FROM Ghre_Course
WHERE (Id = '{entity.CourseId}' OR CourseSceneId = '{entity.CourseSceneId}' OR CourseSceneIds like '%{entity.CourseSceneId}%') AND IsEnable = 1)"; WHERE (Id = '{entity.CourseId}' OR CourseSceneId = '{entity.CourseSceneId}' OR CourseSceneIds like '%{entity.CourseSceneId}%') AND IsEnable = 1)";
var count = await Db.Ado.GetIntAsync(sql); var count = await Db.Ado.GetIntAsync(sql);
if (count == 0) if (count == 0)
{ {
if (entity.LinkType == "CourseId") if (entity.LinkType == "CourseId")
return ServiceResult.OprateFailed("该考试关联的课程未维护课件,暂不可发布!"); return ServiceResult.OprateFailed("该考试关联的课程未维护课件,暂不可取消归档!");
}
} }
#endregion #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)
{ {

Loading…
Cancel
Save