SELECT A.*,IFNULL(B.RoomName,'') AS RoomName,IFNULL(T.TeacherName,'') AS TeacherName,IFNULL(T.TeacherHead,'') AS UserIcon
,Time.StartTime,time.EndTime,TIMESTAMPDIFF(MINUTE, CONCAT('2020-12-16',' ',time.StartTime), CONCAT('2020-12-16',' ',time.EndTime)) AS ClassMinutes
,Time.StartTime,time.EndTime,time.ClassTimeId
,TIMESTAMPDIFF(MINUTE, CONCAT('2020-12-16',' ',time.StartTime), CONCAT('2020-12-16',' ',time.EndTime)) AS ClassMinutes
FROM RB_Class_Plan AS A LEFT JOIN rb_class_room AS B ON A.ClassRoomId=B.RoomId
LEFT JOIN rb_teacher AS T ON A.TeacherId=T.TId
LEFT JOIN rb_class_time AS time ON A.ClassPlanId=Time.ClassPlanId
...
...
@@ -103,6 +104,10 @@ WHERE 1=1
{
builder.AppendFormat(" AND A.{0}={1} ",nameof(RB_Class_Plan_ViewModel.School_Id),query.School_Id);
}
if(query.ClassTimeId>0)
{
builder.AppendFormat(" AND time.{0}={1} ",nameof(RB_Class_Plan_ViewModel.ClassTimeId),query.ClassTimeId);
}
if(!string.IsNullOrEmpty(query.QClassIds))
{
builder.AppendFormat(" AND A.{0} IN({1}) ",nameof(RB_Class_Plan_ViewModel.ClassId),query.QClassIds);
...
...
@@ -357,7 +362,7 @@ FROM RB_Class_Plan AS A LEFT JOIN rb_class_room AS B ON A.ClassRoomId=B.RoomId
LEFT JOIN rb_class as class on a.ClassId=class.ClassId
LEFT JOIN rb_teacher AS T ON A.TeacherId=T.TId
LEFT JOIN (SELECT ClassPlanId,COUNT(*) as LessonPlanNum from rb_class_lessonplan where `Status`=0 GROUP BY ClassPlanId)as lp on a.ClassPlanId=lp.ClassPlanId
WHERE 1=1
WHERE 1=1 and class.ClassStatus=2 and t.`Status`=0
");
builder.AppendFormat(" AND A.{0}={1} ",nameof(RB_Class_Plan_ViewModel.Status),(int)DateStateEnum.Normal);
if(query!=null)
...
...
@@ -470,7 +475,7 @@ where sog.Account_Id={query.StuId} and c.ClassStatus in(1,2) and c.`Status`=0 an
builder.AppendFormat(@" SELECT a.*,c.ClassName,b.ClassRoomId from rb_class_time as a LEFT JOIN rb_class_plan as b on a.ClassPlanId=b.ClassPlanId
builder.AppendFormat(@" SELECT a.*,c.ClassName,b.ClassRoomId,t.TeacherName from rb_class_time as a LEFT JOIN rb_class_plan as b on a.ClassPlanId=b.ClassPlanId
LEFT JOIN rb_class as c on a.ClassId=c.ClassId
where b.`Status`=0 and DATE_FORMAT(b.ClassDate,'%y/%m/%d')=DATE_FORMAT(NOW(),'%y/%m/%d') and c.`Status`=0 and c.ClassStatus=2 ");
LEFT JOIN rb_teacher as t on b.TeacherId=t.TId
where b.`Status`=0 and DATE_FORMAT(b.ClassDate,'%y/%m/%d')=DATE_FORMAT(NOW(),'%y/%m/%d') and t.`Status`=0 and c.`Status`=0 and c.ClassStatus=2 ");
if(query!=null)
{
if(query.ClassPlanId>0)
...
...
@@ -208,13 +209,13 @@ where b.`Status`=0 and DATE_FORMAT(b.ClassDate,'%y/%m/%d')=DATE_FORMAT(NOW(),'%y
{
StringBuilderbuilder=newStringBuilder();
builder.AppendFormat($@"SELECT t.TeacherName,t.TeacherHead,c.ClassHours,c.ClassName,cou.CourseName,lp.LessonPlanId,A.ClassPlanId,A.ClassId,A.`Status`,A.ClassRoomId,A.Group_Id,A.School_Id,A.TeacherId,B.ClassTimeId,CONCAT( DATE_FORMAT(A.ClassDate,'%Y-%m-%d') ,' ',B.StartTime,':00') AS NewPlanDateTime,
B.EndTime,B.StartTime,B.SuiPai,B.ClassStatus,CONCAT( DATE_FORMAT(A.ClassDate,'%Y-%m-%d') ,' ',B.EndTime,':00') AS NewEndPlanDateTime
B.EndTime,B.StartTime,B.SuiPai,B.VideoUrl,B.ClassStatus,CONCAT( DATE_FORMAT(A.ClassDate,'%Y-%m-%d') ,' ',B.EndTime,':00') AS NewEndPlanDateTime
FROM rb_class_plan AS A INNER JOIN rb_class_time AS B ON A.ClassPlanId=B.ClassPlanId
LEFT JOIN rb_teacher as t on a.TeacherId=t.TId
LEFT JOIN rb_class as c on c.ClassId=a.ClassId
LEFT JOIN rb_course as cou on cou.CourseId=c.CouseId
LEFT JOIN (SELECT ClassPlanId,MAX(LessonPlanId) as LessonPlanId from rb_class_lessonplan where `Status`=0 GROUP BY ClassPlanId) as lp on lp.ClassPlanId=a.ClassPlanId
where a.`Status`=0 and c.ClassStatus =2 and a.ClassRoomId={RoomId} and a.Group_Id={Group_Id} and DATE_FORMAT(A.ClassDate,'%Y-%m-%d')>=DATE_FORMAT(NOW(),'%Y-%m-%d') ORDER BY CONCAT( DATE_FORMAT(A.ClassDate,'%Y-%m-%d') ,' ',B.EndTime,':00') asc LIMIT 10");
where a.`Status`=0 and b.ClassStatus<>2 and c.ClassStatus =2 and a.ClassRoomId={RoomId} and a.Group_Id={Group_Id} and DATE_FORMAT(A.ClassDate,'%Y-%m-%d')>=DATE_FORMAT(NOW(),'%Y-%m-%d') ORDER BY CONCAT( DATE_FORMAT(A.ClassDate,'%Y-%m-%d') ,' ',B.EndTime,':00') asc LIMIT 10");