builder.AppendFormat($@"SELECT a.*,c.ClassName,lp.LessonPlanNum,c.ClassHours,b.RoomName,IFNULL(T.TeacherHead,'') AS UserIcon,IFNULL(T.TeacherName,'') AS TeacherName FROM rb_class_plan as a LEFT JOIN rb_class as c on a.ClassId=c.ClassId
builder.AppendFormat($@"
SELECT a.*,c.ClassName,lp.LessonPlanNum,c.ClassHours,b.RoomName,IFNULL(T.TeacherHead,'') AS UserIcon,IFNULL(T.TeacherName,'') AS TeacherName FROM rb_class_plan as a LEFT JOIN rb_class as c on a.ClassId=c.ClassId
LEFT JOIN rb_class_room as b on a.ClassRoomId=b.RoomId
LEFT JOIN rb_teacher AS T ON c.Teacher_Id=T.TId
LEFT JOIN rb_student_orderguest as sog on sog.ClassId=c.ClassId
SELECT A.*,IFNULL(B.ClassName,'') AS ClassName,IFNULL(B.ClassNo,'') AS ClassNo,IFNULL(C.JoinType,0) AS StuJoinType,IFNULL(D.GuestState,0) AS StuGuestState
,C.OrderState,IFNULL(D.TotalHours,0) AS TotalHours,IFNULL(D.CompleteHours,0) AS CompleteHours,IFNULL(B.ClassStatus,0) AS ClassStatus
FROM RB_Student_OrderGuest AS A LEFT JOIN rb_class AS B ON A.ClassId=B.ClassId
LEFT JOIN rb_order AS C ON A.OrderId=C.OrderId
LEFT JOIN rb_order_guest AS D ON A.GuestId=D.Id
LEFT JOIN rb_order_guest AS D ON A.GuestId=D.Id
WHERE 1=1
");
builder.AppendFormat(" AND A.{0}={1} ",nameof(RB_Student_OrderGuest_ViewModel.Status),(int)DateStateEnum.Normal);