|
|
@@ -90,59 +90,50 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration |
|
|
|
var queryParam = queryJson.ToJObject(); |
|
|
|
// 虚拟参数 |
|
|
|
string sql1 = " "; |
|
|
|
string sql2 = " "; |
|
|
|
string sql3 = " "; |
|
|
|
|
|
|
|
if (!queryParam["StartTime"].IsEmpty() && !queryParam["EndTime"].IsEmpty()) |
|
|
|
{ |
|
|
|
sql1 = " and Createtime >= '" + queryParam["StartTime"].ToDate() |
|
|
|
+ "' and Createtime <= '" + queryParam["EndTime"].ToDate() + "' "; |
|
|
|
sql1 = " and DkDate >= '" + queryParam["StartTime"].ToDate() |
|
|
|
+ "' and DkDate <= '" + queryParam["EndTime"].ToDate() + "' "; |
|
|
|
} |
|
|
|
if (!queryParam["F_School"].IsEmpty()) |
|
|
|
{ |
|
|
|
sql2 = " and F_School ='" + queryParam["F_School"].ToString() + "' "; |
|
|
|
sql1 = " and F_School ='" + queryParam["F_School"].ToString() + "' "; |
|
|
|
} |
|
|
|
if (!queryParam["MajorNo"].IsEmpty()) |
|
|
|
{ |
|
|
|
sql2 += "and MajorNo ='" + queryParam["MajorNo"].ToString() + "'"; |
|
|
|
sql1 += " and MajorNo ='" + queryParam["MajorNo"].ToString() + "'"; |
|
|
|
} |
|
|
|
if (!queryParam["ClassNo"].IsEmpty()) |
|
|
|
{ |
|
|
|
sql2 += "and ClassNo ='" + queryParam["ClassNo"].ToString() + "'"; |
|
|
|
sql1 += " and ClassNo ='" + queryParam["ClassNo"].ToString() + "'"; |
|
|
|
} |
|
|
|
|
|
|
|
if (!queryParam["StuNo"].IsEmpty()) |
|
|
|
{ |
|
|
|
sql2 += "and StuNo like '%" + queryParam["StuNo"].ToString() + "%'"; |
|
|
|
sql1 += " and StuNo like '%" + queryParam["StuNo"].ToString() + "%'"; |
|
|
|
} |
|
|
|
if (!queryParam["StuName"].IsEmpty()) |
|
|
|
{ |
|
|
|
sql2 += "and StuName like '%" + queryParam["StuName"].ToString() + "%'"; |
|
|
|
sql1 += " and StuName like '%" + queryParam["StuName"].ToString() + "%'"; |
|
|
|
} |
|
|
|
if (!queryParam["IsStatus"].IsEmpty()) |
|
|
|
{ |
|
|
|
sql3 = " and t.num >= '" + queryParam["IsStatus"].ToString() + "' "; |
|
|
|
sql1 = " and t.num = '" + queryParam["IsStatus"].ToString() + "' "; |
|
|
|
} |
|
|
|
strSql.Append(@"select * from ( |
|
|
|
select zb.*,aa.address as Address1,aa.Temperature as Temperature1 ,bb.address as Address2,bb.Temperature as Temperature2,cc.address as Address3 ,cc.Temperature |
|
|
|
as Temperature3,dd.Num from (select F_School,MajorNo,ClassNo,StuNo,StuName,DKDate,Phone from HealthPunchStu |
|
|
|
where 1=1 " + sql1 + sql2 + " "); |
|
|
|
strSql.Append(@" Group by F_School,MajorNo,ClassNo,StuNo,StuName,DKDate,Phone )zb |
|
|
|
left join (select * from HealthPunchStu where 1=1 " + sql1 + " )"); |
|
|
|
strSql.Append(@" AA on AA.F_School=zb.F_School and AA.MajorNo=zb.MajorNo |
|
|
|
and AA.ClassNo=zb.ClassNo and AA.StuNo=zb.Stuno and AA.StuName=zb.StuName |
|
|
|
and AA.Phone=zb.Phone and AA.dkDate=zb.Dkdate and AA.dkType=1 |
|
|
|
left join (select * from HealthPunchStu where 1=1 " + sql1 + " )"); |
|
|
|
strSql.Append(@" BB on BB.F_School=zb.F_School and BB.MajorNo=zb.MajorNo |
|
|
|
and BB.ClassNo=zb.ClassNo and BB.StuNo=zb.Stuno and BB.StuName=zb.StuName |
|
|
|
and BB.Phone=zb.Phone and BB.dkDate=zb.Dkdate and BB.dkType=2 |
|
|
|
left join (select * from HealthPunchStu where 1=1 " + sql1 + " )"); |
|
|
|
strSql.Append(@" CC on CC.F_School=zb.F_School and CC.MajorNo=zb.MajorNo |
|
|
|
and CC.ClassNo=zb.ClassNo and CC.StuNo=zb.Stuno and CC.StuName=zb.StuName |
|
|
|
and CC.Phone=zb.Phone and CC.dkDate=zb.Dkdate and CC.dkType=3 |
|
|
|
left join (select Stuno ,Count(*) as num from HealthPunchStu group by Stuno ) dd on dd.StuNo=zb.Stuno |
|
|
|
)t where 1=1 " + sql3 + " "); |
|
|
|
return this.BaseRepository("CollegeMIS").FindList<HealthPunchStuEntity>(strSql.ToString()); |
|
|
|
strSql.Append(@" select t.* from ( select zb.F_SchoolId as F_School,zb.MajorNo,zb.ClassNo,zb.StuNo,zb.StuName,zb.mobile,isnull(fb.DkDate,Getdate()) as DkDate, |
|
|
|
fb.Address1,fb.Address2,fb.Address3,fb.Temperature1,fb.Temperature2,fb.Temperature3,isnull(fb.Num,0) as Num from StuInfoBasic zb |
|
|
|
left join ( |
|
|
|
select hps.*,aa.address as Address1,aa.Temperature as Temperature1 ,bb.address as Address2,bb.Temperature as Temperature2,cc.address as Address3 ,cc.Temperature |
|
|
|
as Temperature3,dd.Num from ( |
|
|
|
select StuNo,StuName,DkDate from HealthPunchStu hps group by StuNo,StuName,DkDate) hps |
|
|
|
left join (select * from HealthPunchStu ) AA on AA.StuNo=hps.StuNo and AA.StuName=hps.StuName and AA.dkType=1 |
|
|
|
left join (select * from HealthPunchStu ) BB on BB.StuNo=hps.Stuno and BB.StuName=hps.StuName and BB.dkType=2 |
|
|
|
left join (select * from HealthPunchStu ) CC on CC.StuNo=hps.Stuno and CC.StuName=hps.StuName and CC.dkType=3 |
|
|
|
left join (select Stuno,Count(*) as num from HealthPunchStu hps group by Stuno ) dd on dd.StuNo=hps.Stuno |
|
|
|
) fb on fb.Stuno = zb.stuno and fb.StuName = zb.StuName --where fb.num >= '1' |
|
|
|
)t where 1=1 " + sql1 + " "); |
|
|
|
return this.BaseRepository("CollegeMIS").FindList<HealthPunchStuEntity>(strSql.ToString(), pagination); |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|