Commit f791d6e5 authored by 黄奎's avatar 黄奎

页面修改

parent c7843d4d
...@@ -567,7 +567,8 @@ FROM rb_student s ...@@ -567,7 +567,8 @@ FROM rb_student s
/// </summary> /// </summary>
/// <param name="demodel"></param> /// <param name="demodel"></param>
/// <returns></returns> /// <returns></returns>
public RB_Student_ViewModel GetStudentFollowUpStat(RB_Student_ViewModel demodel) { public RB_Student_ViewModel GetStudentFollowUpStat(RB_Student_ViewModel demodel)
{
DynamicParameters parameters = new DynamicParameters(); DynamicParameters parameters = new DynamicParameters();
string where = " 1=1 and s.Status =0 and c.CourseId <>1";//排除内部班 string where = " 1=1 and s.Status =0 and c.CourseId <>1";//排除内部班
if (demodel.Group_Id > 0) if (demodel.Group_Id > 0)
...@@ -682,26 +683,28 @@ FROM rb_student s ...@@ -682,26 +683,28 @@ FROM rb_student s
where += $" AND s.{nameof(RB_Student_ViewModel.CreateBy)} ={demodel.CreateBy} "; where += $" AND s.{nameof(RB_Student_ViewModel.CreateBy)} ={demodel.CreateBy} ";
} }
} }
string joinType = "INNER JOIN";
if (demodel.QueryTpye == 3)
{
joinType = "LEFT JOIN";
}
string sql = $@" string sql = $@"
select count(0) as OrderCount,sum(case when t.RenewState = 1 then 1 else 0 end) AS RenewOrderCount, SELECT count(0) as OrderCount,sum(case when t.RenewState = 1 then 1 else 0 end) AS RenewOrderCount,
SUM(CASE WHEN t.StuGuestState in(1,3,4,6,8,9) THEN 1 ELSE 0 END) AS StudyNum, SUM(CASE WHEN t.StuGuestState in(1,3,4,6,8,9) THEN 1 ELSE 0 END) AS StudyNum,
SUM(CASE WHEN t.StuGuestState =2 THEN 1 ELSE 0 END) AS DropOutNum, SUM(CASE WHEN t.StuGuestState =2 THEN 1 ELSE 0 END) AS DropOutNum,
SUM(CASE WHEN t.StuGuestState =5 THEN 1 ELSE 0 END) AS SuspendNum, SUM(CASE WHEN t.StuGuestState =5 THEN 1 ELSE 0 END) AS SuspendNum,
SUM(CASE WHEN t.StuGuestState =7 THEN 1 ELSE 0 END) AS GraduateNum SUM(CASE WHEN t.StuGuestState =7 THEN 1 ELSE 0 END) AS GraduateNum
from( FROM(
SELECT s.StuId,s.StuName,s.StuTel,s.StuRealMobile,s.QQ,ec.CreateTime,c.CourseId,c.CourseName,s.JapanBaseInfo,s.StuBirth,org.GuestState as StuGuestState, SELECT s.StuId,s.StuName,s.StuTel,s.StuRealMobile,s.QQ,ec.CreateTime,c.CourseId,c.CourseName,s.JapanBaseInfo,s.StuBirth
case when o.RenewOrderId >0 or org.RenewState =2 then 1 else 0 end AS RenewState ,org.GuestState as StuGuestState,case when o.RenewOrderId >0 or org.RenewState =2 then 1 else 0 end AS RenewState
FROM rb_student s FROM rb_student s
INNER JOIN rb_student_orderguest og on og.Student_Id = s.StuId {joinType} 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 {joinType} (SELECT og.Student_Id,MAX(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
INNER JOIN rb_order o on og.OrderId = o.OrderId {joinType} rb_order_guest org on org.Id = og.GuestId
WHERE o.OrderState <>3 GROUP BY og.Student_Id) stu on og.Id = stu.Id and og.Student_Id = s.StuId {joinType} rb_order o on og.OrderId = o.OrderId
INNER JOIN rb_order_guest org on org.Id = og.GuestId {joinType} rb_class cl on cl.ClassId = o.ClassId
INNER JOIN rb_order o on og.OrderId = o.OrderId {joinType} rb_course c on o.CourseId = c.CourseId
inner join rb_class cl on cl.ClassId = o.ClassId LEFT JOIN rb_education_contract ec on ec.GuestId = og.GuestId ";
INNER JOIN rb_course c on o.CourseId = c.CourseId
LEFT JOIN rb_education_contract ec on ec.GuestId = og.GuestId";
if (!string.IsNullOrEmpty(demodel.SFTime) && !string.IsNullOrEmpty(demodel.EFTime)) if (!string.IsNullOrEmpty(demodel.SFTime) && !string.IsNullOrEmpty(demodel.EFTime))
{ {
//增加跟进链表 //增加跟进链表
......
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