@@ -423,16 +423,18 @@ WHERE p.`Status`=0 AND p.Group_Id={group_Id} AND p.ClassId ={classId}
{
StringBuilderbuilder=newStringBuilder();
builder.AppendFormat(@"
SELECT * from (SELECT
(SELECT COUNT(*) from rb_class_plan where `Status`=0 and DATE_FORMAT(ClassDate,'%Y-%m-%d') <=DATE_FORMAT(a.ClassDate,'%Y-%m-%d') and ClassId=a.ClassId) as Ranks,
A.*,class.ClassName,lp.LessonPlanNum,lps.LessonPlanSummaryNum,IFNULL(B.RoomName,'') AS RoomName,IFNULL(T.TeacherName,'') AS TeacherName,IFNULL(T.TeacherHead,'') AS UserIcon
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
LEFT JOIN (SELECT ClassPlanId,COUNT(*) as LessonPlanSummaryNum from rb_class_lessonplan where `Status`=0 and ISNULL(Summary)=0 and LENGTH(trim(Summary))>0 GROUP BY ClassPlanId)as lps on a.ClassPlanId=lps.ClassPlanId
WHERE 1=1 and class.ClassStatus in(1,2) and t.`Status`=0 and a.`Status`=0 and class.`Status`=0 ORDER BY a.ClassId,a.ClassDate) as a where 1=1
");
SELECT *
FROM
( SELECT (SELECT COUNT(*) from rb_class_plan where `Status`=0 and DATE_FORMAT(ClassDate,'%Y-%m-%d') <=DATE_FORMAT(a.ClassDate,'%Y-%m-%d') and ClassId=a.ClassId) as Ranks,
A.*,class.ClassName,lp.LessonPlanNum,lps.LessonPlanSummaryNum,IFNULL(B.RoomName,'') AS RoomName,IFNULL(T.TeacherName,'') AS TeacherName,IFNULL(T.TeacherHead,'') AS UserIcon
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
LEFT JOIN (SELECT ClassPlanId,COUNT(*) as LessonPlanSummaryNum from rb_class_lessonplan where `Status`=0 and ISNULL(Summary)=0 and LENGTH(trim(Summary))>0 GROUP BY ClassPlanId) as lps on a.ClassPlanId=lps.ClassPlanId
WHERE 1=1 and class.ClassStatus in(1,2,3) and t.`Status`=0 and a.`Status`=0 and class.`Status`=0 ORDER BY a.ClassId,a.ClassDate
) AS a
WHERE 1=1 ");
builder.AppendFormat(" AND A.{0}={1} ",nameof(RB_Class_Plan_ViewModel.Status),(int)DateStateEnum.Normal);