SELECT A.*,B.CourseName,C.AssistName,IFNULL(C.AssistIcon,'') AS AssistIcon,D.TeacherName,IFNULL(D.TeacherHead,'') AS TeacherHead
,E.SName AS SchoolName,IFNULL(F.RoomName,'') AS RoomName,plan.TotalPlanNum,ySplan.UsePlanNum,B.CourseSubject
,E.SName AS SchoolName,IFNULL(F.RoomName,'') AS RoomName,plan.TotalPlanNum,ySplan.UsePlanNum,B.CourseSubject,IFNULL(csubject.SubjectName,'') AS CourseSubjectName
FROM rb_class AS A LEFT JOIN rb_course AS B ON A.CouseId=B.CourseId
LEFT JOIN rb_assist AS C ON A.Assist_Id=C.AId
LEFT JOIN rb_teacher AS D ON A.Teacher_Id=D.TId
...
...
@@ -222,6 +222,7 @@ FROM rb_class AS A LEFT JOIN rb_course AS B ON A.CouseId=B.CourseId
LEFT JOIN rb_class_room AS F ON A.ClassRoomId=F.RoomId
LEFT JOIN ((SELECT ClassId,COUNT(*) AS TotalPlanNum FROM rb_class_plan where `Status`=0 GROUP BY ClassId)) as plan on plan.ClassId=a.ClassId
LEFT JOIN ((SELECT ClassId,COUNT(*) AS UsePlanNum FROM rb_class_plan where `Status`=0 and DATE_FORMAT(ClassDate,'%Y-%m-%d') <=DATE_FORMAT(NOW(),'%Y-%m-%d') GROUP BY ClassId)) as ySplan on ySplan.ClassId=a.ClassId
LEFT JOIN rb_course_subject AS csubject ON B.CourseSubject=csubject.Id
WHERE 1=1
");
if(query!=null)
...
...
@@ -293,7 +294,7 @@ WHERE 1=1
}
if(query.CourseSubject>0)
{
builder.AppendFormat(" AND B.{0}={1} ",nameof(RB_Class_ViewModel.CourseSubject),(int)query.CourseSubject);
builder.AppendFormat(" AND B.{0}={1} ",nameof(RB_Class_ViewModel.CourseSubject),query.CourseSubject);