master
xiaochanghai 11 months ago
parent 6ce95023d5
commit 021884c0aa
  1. 2
      Tiobon.Core.Model/ViewModels/Extend/CoursePublicSearchField.cs
  2. 38
      Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs

@ -40,6 +40,8 @@ public class CoursePublic
public string BtnActionType { get; set; } = "Add";
public int AfterHowLong { get; set; }
public string ExamDateString { get; set; }
public long? StudyRecordId { get; set; }
}

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

Loading…
Cancel
Save