Commit 1797e725 authored by liudong1993's avatar liudong1993

1

parent d1a44042
...@@ -274,6 +274,10 @@ INNER JOIN rb_order o on sog.OrderId = o.OrderId ...@@ -274,6 +274,10 @@ INNER JOIN rb_order o on sog.OrderId = o.OrderId
{ {
where += $" and s.{nameof(RB_Student_ViewModel.StuType)} ={demodel.StuType}"; where += $" and s.{nameof(RB_Student_ViewModel.StuType)} ={demodel.StuType}";
} }
if (demodel.StuChannel > 0)
{
where += $" and s.{nameof(RB_Student_ViewModel.StuChannel)} ={demodel.StuChannel}";
}
if (demodel.StuGuestState > 0) if (demodel.StuGuestState > 0)
{ {
where += $" and org.GuestState ={(int)demodel.StuGuestState}"; where += $" and org.GuestState ={(int)demodel.StuGuestState}";
...@@ -411,6 +415,10 @@ LEFT JOIN rb_education_contract ec on ec.GuestId = og.GuestId"; ...@@ -411,6 +415,10 @@ LEFT JOIN rb_education_contract ec on ec.GuestId = og.GuestId";
{ {
where += $" and org.GuestState ={(int)demodel.StuGuestState}"; where += $" and org.GuestState ={(int)demodel.StuGuestState}";
} }
if (demodel.StuChannel > 0)
{
where += $" and s.{nameof(RB_Student_ViewModel.StuChannel)} ={demodel.StuChannel}";
}
if (demodel.StuStage > 0) if (demodel.StuStage > 0)
{ {
where += $" and s.{nameof(RB_Student_ViewModel.StuStage)} ={demodel.StuStage}"; where += $" and s.{nameof(RB_Student_ViewModel.StuStage)} ={demodel.StuStage}";
...@@ -553,6 +561,10 @@ LEFT JOIN rb_education_contract ec on ec.GuestId = og.GuestId"; ...@@ -553,6 +561,10 @@ LEFT JOIN rb_education_contract ec on ec.GuestId = og.GuestId";
{ {
where += $" and s.{nameof(RB_Student_ViewModel.StuType)} ={demodel.StuType}"; where += $" and s.{nameof(RB_Student_ViewModel.StuType)} ={demodel.StuType}";
} }
if (demodel.StuChannel > 0)
{
where += $" and s.{nameof(RB_Student_ViewModel.StuChannel)} ={demodel.StuChannel}";
}
if (demodel.StuGuestState > 0) if (demodel.StuGuestState > 0)
{ {
where += $" and og.GuestState ={(int)demodel.StuGuestState}"; where += $" and og.GuestState ={(int)demodel.StuGuestState}";
...@@ -574,6 +586,17 @@ LEFT JOIN rb_education_contract ec on ec.GuestId = og.GuestId"; ...@@ -574,6 +586,17 @@ LEFT JOIN rb_education_contract ec on ec.GuestId = og.GuestId";
{ {
where += $@" AND s.StuId IN (SELECT StuId FROM rb_student_assist WHERE AssistId ={demodel.ConsultantId} AND `Status`=0)"; where += $@" AND s.StuId IN (SELECT StuId FROM rb_student_assist WHERE AssistId ={demodel.ConsultantId} AND `Status`=0)";
} }
if (!string.IsNullOrEmpty(demodel.SFTime) && !string.IsNullOrEmpty(demodel.EFTime))
{
if (demodel.Q_FType == 1)
{
where += $" and f.Id is not null";
}
else
{
where += $" and f.Id is null";
}
}
if (demodel.BelongType > 0) if (demodel.BelongType > 0)
{ {
//全部 //全部
...@@ -622,13 +645,18 @@ LEFT JOIN ( ...@@ -622,13 +645,18 @@ LEFT JOIN (
SELECT sog.Student_Id,MAX(og.Id) AS GuestId FROM rb_student_orderguest sog SELECT sog.Student_Id,MAX(og.Id) AS GuestId FROM rb_student_orderguest sog
INNER JOIN rb_order o on sog.OrderId = o.OrderId INNER JOIN rb_order o on sog.OrderId = o.OrderId
INNER JOIN rb_order_guest og on sog.GuestId = og.Id INNER JOIN rb_order_guest og on sog.GuestId = og.Id
WHERE o.Group_Id =100000 and sog.`Status` =0 and o.OrderState <>3 and og.`Status` =0 GROUP BY sog.Student_Id WHERE o.Group_Id ={demodel.Group_Id} and sog.`Status` =0 and o.OrderState <>3 and og.`Status` =0 GROUP BY sog.Student_Id
) ot on s.StuId = ot.Student_Id ) ot on s.StuId = ot.Student_Id
LEFT JOIN rb_order_guest og on ot.GuestId = og.Id LEFT JOIN rb_order_guest og on ot.GuestId = og.Id
LEFT JOIN rb_order o on og.OrderId = o.OrderId LEFT JOIN rb_order o on og.OrderId = o.OrderId
LEFT JOIN rb_course c on o.CourseId = c.CourseId LEFT JOIN rb_course c on o.CourseId = c.CourseId
LEFT JOIN rb_channel ch on s.StuChannel = ch.Id LEFT JOIN rb_channel ch on s.StuChannel = ch.Id";
WHERE {where} if (!string.IsNullOrEmpty(demodel.SFTime) && !string.IsNullOrEmpty(demodel.EFTime))
{
//增加跟进链表
sql += $@" LEFT JOIN rb_student_follow f on s.StuId = f.StuId and f.`Status` =0 and f.AssistType =2 and f.CreateTime >='{demodel.SFTime}' and f.CreateTime <='{demodel.EFTime} 23:59:59'";
}
sql +=$@" WHERE {where}
GROUP BY s.StuId order by s.StuId desc"; GROUP BY s.StuId order by s.StuId desc";
return GetPage<RB_Student_ViewModel>(pageIndex, pageSize, out count, sql, parameters).ToList(); return GetPage<RB_Student_ViewModel>(pageIndex, pageSize, out count, sql, parameters).ToList();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment