|
|
@ -599,33 +599,40 @@ public class Ghre_CourseServices : BaseServices<Ghre_Course, Ghre_CourseDto, Ins |
|
|
|
#region 获取公开课 |
|
|
|
#region 获取公开课 |
|
|
|
public async Task<ServicePageResult<CoursePublic>> QueryPublic(QueryBody filter) |
|
|
|
public async Task<ServicePageResult<CoursePublic>> QueryPublic(QueryBody filter) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
int? staffId = GetStaffId(); |
|
|
|
RefAsync<int> totalCount = 0; |
|
|
|
RefAsync<int> totalCount = 0; |
|
|
|
|
|
|
|
var dt = DateTime.Now.Date; |
|
|
|
string sql = @$"SELECT A.Id,
|
|
|
|
string sql = @$"SELECT A.Id,
|
|
|
|
A.CoverUrl, |
|
|
|
A.CoverUrl, |
|
|
|
A.UseDefaultCoverImage, |
|
|
|
A.UseDefaultCoverImage, |
|
|
|
A.DefaultCoverImageName, |
|
|
|
A.DefaultCoverImageName, |
|
|
|
A.CourseName + ' (' + A.CourseNo + ')' CourseName, |
|
|
|
A.CourseName + ' (' + A.CourseNo + ')' CourseName, |
|
|
|
A.StandardHour, |
|
|
|
ISNULL (A.StandardHour, 0) StandardHour, |
|
|
|
A.CreditPoints, |
|
|
|
ISNULL (A.CreditPoints, 0) CreditPoints, |
|
|
|
NULL |
|
|
|
NULL ExamDate, |
|
|
|
ExamDate, |
|
|
|
B.BeginTime ExamBeginDate, |
|
|
|
B.BeginTime |
|
|
|
B.EndTime ExamEndDate, |
|
|
|
ExamBeginDate, |
|
|
|
CAST ('0' AS BIT) DisableBtn, |
|
|
|
B.EndTime |
|
|
|
|
|
|
|
ExamEndDate, |
|
|
|
|
|
|
|
CAST ('0' AS BIT) |
|
|
|
|
|
|
|
DisableBtn, |
|
|
|
|
|
|
|
B.DateType, |
|
|
|
B.DateType, |
|
|
|
B.AfterHowLong |
|
|
|
B.AfterHowLong, |
|
|
|
|
|
|
|
C.Id StudyRecordId |
|
|
|
FROM Ghre_Course A |
|
|
|
FROM Ghre_Course A |
|
|
|
LEFT JOIN Ghre_Exam B |
|
|
|
LEFT JOIN Ghre_Exam B |
|
|
|
ON A.Id = B.CourseId |
|
|
|
ON A.Id = B.CourseId |
|
|
|
AND B.Status = '{DIC_EXAM_STATUS.RELEASED}' |
|
|
|
AND B.Status = '{DIC_EXAM_STATUS.RELEASED}' |
|
|
|
AND ( ( B.DateType = '{DicExamDateType.EXAM_DATE}' |
|
|
|
AND ( ( B.DateType = '{DicExamDateType.EXAM_DATE}' |
|
|
|
AND B.BeginTime <= '{DateTime.Now.Date}' |
|
|
|
AND B.BeginTime <= '{dt}' |
|
|
|
AND B.EndTime >= '{DateTime.Now.Date}') |
|
|
|
AND B.EndTime >= '{dt}') |
|
|
|
OR B.DateType = '{DicExamDateType.AFTER_HOW_LONG}') |
|
|
|
OR B.DateType = '{DicExamDateType.AFTER_HOW_LONG}') |
|
|
|
WHERE A.IsOPen = 'true' AND A.IsEnable = 1 AND A.Status = '{DIC_COURSE_STATUS.RELEASED}'";
|
|
|
|
LEFT JOIN Ghre_StudyRecord C |
|
|
|
|
|
|
|
ON A.Id = C.CourseId |
|
|
|
|
|
|
|
AND C.IsEnable = 1 |
|
|
|
|
|
|
|
AND C.StaffId = '{staffId}' |
|
|
|
|
|
|
|
AND C.CourseBeginTime <= '{dt}' |
|
|
|
|
|
|
|
AND C.CourseEndTime >= '{dt}' |
|
|
|
|
|
|
|
WHERE A.IsOPen = 'true' |
|
|
|
|
|
|
|
AND A.IsEnable = 1 |
|
|
|
|
|
|
|
AND A.Status = '{DIC_COURSE_STATUS.RELEASED}'";
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(filter.orderBy)) |
|
|
|
if (string.IsNullOrWhiteSpace(filter.orderBy)) |
|
|
|
filter.orderBy = "CourseName ASC"; |
|
|
|
filter.orderBy = "CourseName ASC"; |
|
|
@ -697,8 +704,11 @@ public class Ghre_CourseServices : BaseServices<Ghre_Course, Ghre_CourseDto, Ins |
|
|
|
data.ForEach(x => |
|
|
|
data.ForEach(x => |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (x.ExamBeginDate != null && x.ExamEndDate != null) |
|
|
|
if (x.ExamBeginDate != null && x.ExamEndDate != null) |
|
|
|
x.ExamDateString = DateTimeHelper.ConvertToDayString(x.ExamBeginDate) + "~" + DateTimeHelper.ConvertToDayString(x.ExamEndDate); |
|
|
|
x.ExamDateString = DateTimeHelper.ConvertToDayString(x.ExamBeginDate) + " ~ " + DateTimeHelper.ConvertToDayString(x.ExamEndDate); |
|
|
|
else x.ExamDateString = $"学完{x.AfterHowLong}天"; |
|
|
|
else x.ExamDateString = $"学完{x.AfterHowLong}天"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!x.StudyRecordId.IsNull()) |
|
|
|
|
|
|
|
x.DisableBtn = true; |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
return new ServicePageResult<CoursePublic>(filter.pageNum, totalCount, filter.pageSize, data); |
|
|
|
return new ServicePageResult<CoursePublic>(filter.pageNum, totalCount, filter.pageSize, data); |
|
|
|