LEFT JOIN rb_teaching_perf t on (c.ClassId = t.ClassId AND t.`Status`=0)
stringsql=$@"
SELECT c.*
FROM rb_class c LEFT JOIN rb_teaching_perf t on (c.ClassId = t.ClassId AND t.`Status`=0)
WHERE c.`Status`=0 and c.Group_Id ={GroupId} and c.ClassStatus =3 and c.EndClassDate <='2030-12-16' AND t.Id IS NULL";
returnGet<RB_Class_ViewModel>(sql).ToList();
}
...
...
@@ -381,19 +380,15 @@ GROUP BY Teacher_Id
{
varparameters=newDynamicParameters();
StringBuilderbuilder=newStringBuilder();
builder.AppendFormat(@"SELECT c.*,cp.ClassPlanId,cp.ClassDate from rb_class as c
LEFT JOIN rb_student_orderguest as sog on sog.ClassId=c.ClassId
LEFT JOIN (SELECT ClassId,MIN(ClassDate) as ClassDate,MIN(ClassPlanId) as ClassPlanId from rb_class_plan where `Status`=0 and DATE_FORMAT(ClassDate,'%y-%M-%d')>=DATE_FORMAT(now(),'%y-%M-%d') GROUP BY ClassId) as cp
on c.ClassId=cp.ClassId
where c.`Status`=0 and sog.`Status`=0 ");
builder.AppendFormat(@"
SELECT c.*,cp.ClassPlanId,cp.ClassDate
FROM rb_class as c LEFT JOIN rb_student_orderguest as sog on sog.ClassId=c.ClassId
LEFT JOIN (SELECT ClassId,MIN(ClassDate) as ClassDate,MIN(ClassPlanId) as ClassPlanId from rb_class_plan where `Status`=0 and DATE_FORMAT(ClassDate,'%y-%M-%d')>=DATE_FORMAT(now(),'%y-%M-%d') GROUP BY ClassId) as cp
on c.ClassId=cp.ClassId
WHERE c.`Status`=0 and sog.`Status`=0 ");
builder.AppendFormat(" AND sog.Student_Id={0} ",Student_Id);
builder.AppendFormat(" AND c.{0}={1} ",nameof(RB_Class_ViewModel.Group_Id),Group_Id);