@@ -925,6 +925,11 @@ WHERE 1=1 AND A.Status=0 AND class.Status=0 AND class.ClassStatus <>4 AND b.Or
...
@@ -925,6 +925,11 @@ WHERE 1=1 AND A.Status=0 AND class.Status=0 AND class.ClassStatus <>4 AND b.Or
builder.AppendFormat(" AND(st.CreateBy = {0} OR EXISTS(SELECT 1 FROM rb_student_assist WHERE StuId = st.StuId AND AssistId = {0})) ",demodel.CreateBy);
builder.AppendFormat(" AND(st.CreateBy = {0} OR EXISTS(SELECT 1 FROM rb_student_assist WHERE StuId = st.StuId AND AssistId = {0})) ",demodel.CreateBy);
}
}
}
}
//班主任
if(demodel.Teacher_Id>0)
{
builder.AppendFormat(" AND EXISTS(SELECT 1 FROM rb_student_assist WHERE AssistType=4 AND StuId=st.StuId AND AssistId={0}) ",demodel.Teacher_Id);
}
builder.AppendFormat($@" order by A.{nameof(RB_Order_Guest_Extend.Id)} desc");
builder.AppendFormat($@" order by A.{nameof(RB_Order_Guest_Extend.Id)} desc");
{joinType} rb_student_orderguest og on og.Student_Id = s.StuId
{joinType} (SELECT og.Student_Id,min(og.Id) as Id FROM rb_student_orderguest og INNER JOIN rb_order o on og.OrderId = o.OrderId WHERE o.OrderState <>3 GROUP BY og.Student_Id) stu on og.Id = stu.Id and og.Student_Id = s.StuId
{joinType} rb_order_guest org on org.Id = og.GuestId
{joinType} rb_order o on og.OrderId = o.OrderId
{joinType} rb_class cl on cl.ClassId = o.ClassId
{joinType} rb_course c on o.CourseId = c.CourseId
LEFT JOIN rb_education_contract ec on ec.GuestId = og.GuestId
LEFT JOIN rb_student_advisorconfig AS b ON s.AdvisorStatus=B.Id
LEFT JOIN (
SELECT B.Student_Id,MIN(A.ClassDate) AS ClassDate
FROM rb_class_check AS A INNER JOIN rb_student_orderguest AS B ON A.OrderGuestId=B.GuestId
WHERE A.Status=0 AND A.CheckStatus=0 GROUP BY B.Student_Id
builder.AppendFormat(" AND s.{0}={1} ",nameof(RB_Student_ViewModel.School_Id),demodel.School_Id);
sql+=$@" LEFT JOIN rb_student_follow f on s.StuId = f.StuId and f.`Status` =0 and f.AssistType in(2,4) and f.CreateTime >='{demodel.SFTime}' and f.CreateTime <='{demodel.EFTime} 23:59:59'";