SET a.ChapterNo = a.ChapterNo +{ChapterNum},a.CourseGradeId = (SELECT CourseRate FROM rb_course_chapter c WHERE c.Group_Id ={groupId} and c.CourseId =a.LearnCourseId and c.ChapterNo =a.ChapterNo)
SET a.ChapterNo = a.ChapterNo +{ChapterNum},a.CourseGradeId = (SELECT CourseRate FROM rb_course_chapter c WHERE c.Group_Id ={groupId} and c.CourseId =a.LearnCourseId and c.ChapterNo =a.ChapterNo)
,a.CourseGradeNo = (SELECT ChapterGradeNo FROM rb_course_chapter c WHERE c.Group_Id ={groupId} and c.CourseId =a.LearnCourseId and c.ChapterNo =a.ChapterNo)
,a.CourseGradeNo = (SELECT ChapterGradeNo FROM rb_course_chapter c WHERE c.Group_Id ={groupId} and c.CourseId =a.LearnCourseId and c.ChapterNo =a.ChapterNo)
builder.AppendFormat(" AND EXISTS (SELECT 1 FROM rb_course_chapter WHERE 1=1 AND (CourseId=B.CourseId OR CourseId IN(SELECT CourseId FROM rb_order_course WHERE OrderId=A.OrderId)) AND CourseRate IN({0})) ",(int)query.QCourseRate);
stringchapterSql=string.Format(" SELECT DISTINCT CourseId FROM rb_course_chapter WHERE Status=0 AND CourseRate ={0} ",(int)query.QCourseRate);
builder.AppendFormat(@" AND (B.CourseId IN({0}) OR EXISTS (SELECT 1 FROM rb_order_course WHERE OrderId=A.OrderId AND CourseId IN({0}))) ",string.Join(",",courseIdList));
//builder.AppendFormat(" AND EXISTS (SELECT 1 FROM rb_course_chapter WHERE 1=1 AND (CourseId=B.CourseId OR CourseId IN(SELECT CourseId FROM rb_order_course WHERE OrderId=A.OrderId)) AND CourseRate IN({0})) ", (int)query.QCourseRate);
}
}
else
else
{
{
...
@@ -81,14 +88,7 @@ WHERE 1=1 AND B.OrderState=1 AND B.OrderType=1 AND E.ClassScrollType=2
...
@@ -81,14 +88,7 @@ WHERE 1=1 AND B.OrderState=1 AND B.OrderType=1 AND E.ClassScrollType=2
SELECT og.*,o.CourseId,g.CourseChapterNo,c.ClassScrollType,o.ScrollSchoolId,g.TotalHours,g.CompleteHours,IFNULL(cc.CheckHours,0) AS CheckHours
FROM rb_student_orderguest og
FROM rb_student_orderguest og
INNER JOIN rb_order_guest g on og.GuestId = g.Id
INNER JOIN rb_order_guest g on og.GuestId = g.Id
INNER JOIN rb_order o on og.OrderId = o.OrderId
INNER JOIN rb_order o on og.OrderId = o.OrderId
INNER JOIN rb_class c on o.ClassId = c.ClassId
INNER JOIN rb_class c on o.ClassId = c.ClassId
LEFT JOIN (SELECT OrderGuestId,SUM(CurrentDeductionHours) AS CheckHours FROM rb_class_check WHERE Status=0 GROUP BY OrderGuestId) AS cc ON og.GuestId=cc.OrderGuestId
WHERE og.Status =0 AND g.`Status` =0 AND o.OrderState <>3 AND o.OrderType =1
WHERE og.Status =0 AND g.`Status` =0 AND o.OrderState <>3 AND o.OrderType =1
";
";
if(group_Id>0)
if(group_Id>0)
...
@@ -1003,6 +1005,13 @@ and og.TotalChapterNo > og.CourseChapterNo and (og.CourseChapterNo + 1 + IFNULL(
...
@@ -1003,6 +1005,13 @@ and og.TotalChapterNo > og.CourseChapterNo and (og.CourseChapterNo + 1 + IFNULL(
SELECT sog.Student_Id,sog.GuestId,sog.OrderId,cou.CourseName,s.StuName as GuestName,og.CourseChapterNo,sa.AppointNum,ss.MakeUpNum
SELECT sog.Student_Id,sog.GuestId,sog.OrderId,cou.CourseName,s.StuName as GuestName,og.CourseChapterNo,sa.AppointNum,ss.MakeUpNum
...
@@ -1036,7 +1045,8 @@ WHERE o.Group_Id ={group_Id} and sog.`Status` =0 and og.GuestState NOT IN(2) and
...
@@ -1036,7 +1045,8 @@ WHERE o.Group_Id ={group_Id} and sog.`Status` =0 and og.GuestState NOT IN(2) and
}
}
//sql += string.Format(@" AND EXISTS (SELECT 1 FROM rb_course_chapter WHERE Status=0 AND CourseId= o.CourseId AND ParentId =0 AND CourseRate ={0})", CourseGradeId);
//sql += string.Format(@" AND EXISTS (SELECT 1 FROM rb_course_chapter WHERE Status=0 AND CourseId= o.CourseId AND ParentId =0 AND CourseRate ={0})", CourseGradeId);
sql+=string.Format(@" AND EXISTS (SELECT 1 FROM rb_course_chapter WHERE Status=0 AND (CourseId= o.CourseId OR CourseId IN(SELECT CourseId FROM rb_order_course WHERE OrderId=sog.OrderId)) AND CourseRate ={0})",CourseGradeId);
//sql += string.Format(@" AND EXISTS (SELECT 1 FROM rb_course_chapter WHERE Status=0 AND (CourseId= o.CourseId OR CourseId IN(SELECT CourseId FROM rb_order_course WHERE OrderId=sog.OrderId)) AND CourseRate ={0})", CourseGradeId);
sql+=string.Format(@" AND (o.CourseId IN({0}) OR EXISTS (SELECT 1 FROM rb_order_course WHERE OrderId=sog.OrderId AND CourseId IN({0}))) ",string.Join(",",courseIdList));