SELECT a.*,contract.ContractNo,contract.Id as ContractId,b.CourseId,IFNULL(C.CourseName,'') AS CourseName,C.CourseRate,class.ClassName,class.ClassNo
,class.Teacher_Id,teacher.TeacherName,b.CreateTime as OrderTime,b.EnterID,b.PreferPrice,b.Income,b.Refund,b.PlatformTax
,(a.TotalHours-a.CompleteHours) as SurplusHours,gc.AbsenceNum,gc.LeaveNum,eventlog.EventlogNum,b.EffectStatus,b.JoinType,sog.Student_Id,st.StuTel,st.StuRealMobile
,(a.TotalHours-a.CompleteHours) as SurplusHours,gc.AbsenceNum,gc.LeaveNum,eventlog.EventlogNum,b.EffectStatus,b.JoinType,sog.Student_Id,st.StuTel,st.StuRealMobile,chl.Name as StuChannelName,st.CreateType,st.StuSourceId,st.StuId,st.CreateBy as StuCreateBy
FROM RB_Order_Guest AS A LEFT JOIN rb_order AS B ON A.OrderId=B.OrderId
LEFT JOIN rb_education_contract as contract on contract.GuestId=a.Id AND contract.`Status`=0
LEFT JOIN rb_student_orderguest as sog on sog.GuestId=a.Id AND sog.`Status`=0
LEFT JOIN rb_student as st ON sog.Student_Id=st.StuId
LEFT JOIN rb_channel as chl ON st.StuChannel=chl.Id
LEFT JOIN rb_class as class on class.ClassId=b.ClassId
LEFT JOIN rb_course AS C ON (B.CourseId=C.CourseId AND B.CourseId>0 AND B.OrderType=1)
LEFT JOIN rb_teacher as teacher on teacher.TId=class.Teacher_Id
...
...
@@ -781,6 +782,16 @@ WHERE 1=1 AND A.Status=0 AND class.Status=0 AND class.ClassStatus <>4 AND b.Or
{
builder.AppendFormat($@" AND (a.TotalHours-a.CompleteHours) <20 ");
}
//2022-01-17
if(demodel.CreateType>0)
{
builder.AppendFormat($@" AND st.CreateType ={(int)demodel.CreateType}");
}
if(demodel.StuChannelId>0)
{
builder.AppendFormat($@" AND st.StuChannel ={demodel.StuChannelId}");
}
builder.AppendFormat($@" order by A.{nameof(RB_Order_Guest_Extend.Id)} desc");
@@ -278,6 +278,10 @@ INNER JOIN rb_order o on sog.OrderId = o.OrderId
{
where+=$" and s.{nameof(RB_Student_ViewModel.StuChannel)} ={demodel.StuChannel}";
}
if(demodel.CreateType>0)
{
where+=$" and s.{nameof(RB_Student_ViewModel.CreateType)} ={(int)demodel.CreateType}";
}
if(demodel.StuGuestState>0)
{
where+=$" and org.GuestState ={(int)demodel.StuGuestState}";
...
...
@@ -351,7 +355,8 @@ INNER JOIN rb_order o on sog.OrderId = o.OrderId
}
}
stringsql=$@"SELECT s.StuId,s.StuName,s.StuTel,s.FirstEnrollDate,s.StuRealMobile,s.QQ,DATE_FORMAT(ec.CreateTime,'%Y-%m-%d') as followUpTime,c.CourseId,c.CourseName,s.JapanBaseInfo,s.StuBirth,org.GuestState as StuGuestState
stringsql=$@"SELECT s.StuId,s.StuName,s.StuTel,s.FirstEnrollDate,s.StuRealMobile,s.QQ,DATE_FORMAT(ec.CreateTime,'%Y-%m-%d') as followUpTime,
c.CourseId,c.CourseName,s.JapanBaseInfo,s.StuBirth,org.GuestState as StuGuestState,s.StuChannel,s.CreateType,s.StuSourceId,s.CreateBy
FROM rb_student s
INNER JOIN rb_student_orderguest og on og.Student_Id = s.StuId
INNER JOIN (SELECT og.Student_Id,MAX(og.Id) as Id FROM rb_student_orderguest og
...
...
@@ -419,6 +424,10 @@ LEFT JOIN rb_education_contract ec on ec.GuestId = og.GuestId";
{
where+=$" and s.{nameof(RB_Student_ViewModel.StuChannel)} ={demodel.StuChannel}";
}
if(demodel.CreateType>0)
{
where+=$" and s.{nameof(RB_Student_ViewModel.CreateType)} ={(int)demodel.CreateType}";
}
if(demodel.StuStage>0)
{
where+=$" and s.{nameof(RB_Student_ViewModel.StuStage)} ={demodel.StuStage}";