strSql.Append(@"select * from(select a.student,b.name as StuName,b.number as StuNo,a.number as SitNumber,c.name as ClassRoomName,c.number as ClassRoomNo,
d.name as LessonName,d.number as LessonNo,e.`year` as AcademicYearNo,e.number as Semester,
f.time as StartDate,f.endtime as EndDate,g.teacher
from tb_paikaorule f left join tb_studentpaikao a on f.currid=a.currid
left join tb_paikaoroom g on f.id=g.paikaoruleid
left join tb_student b on a.student=b.id and a.semester=b.semester
left join tb_classroom c on a.classroom=c.id left join tb_curriculum d on a.currid=d.id
left join tb_semester e on a.semester=e.id
where a.student is not null and a.currid is not null) t where 1=1 ");
strSql.Append(@"select * from(SELECT semester.year AS 'AcademicYearNo',semester.number AS 'Semester',currid.number AS 'LessonNo',currid.name AS 'LessonName',
student.name AS 'StuName',student.number AS 'StuNo',classroom.name 'ClassRoomName',classroom.number AS 'ClassRoomNo',
paikao.time AS 'StartDate',paikao.endtime 'EndDate',a.number 'SitNumber',
(SELECT GROUP_CONCAT( teachername) FROM tb_paikao WHERE currid=a.`currid` AND classroomid = a.`classroom`) AS EmpName,
(SELECT GROUP_CONCAT(number) FROM tb_teacher WHERE id IN
(SELECT teacherid FROM tb_paikao WHERE currid=a.`currid` AND classroomid = a.`classroom`) ) AS EmpNo
FROM tb_studentpaikao a
LEFT JOIN tb_student student ON student.id = a.student
LEFT JOIN tb_classroom classroom ON classroom.id = a.classroom
LEFT JOIN tb_curriculum currid ON currid.id = a.currid
LEFT JOIN tb_semester semester ON semester.id = a.semester
LEFT JOIN tb_paikaorule paikao ON paikao.currid= a.currid ) t where 1=1 ");
var queryParam = queryJson.ToJObject();
if (!queryParam["AcademicYearNo"].IsEmpty())
{
@@ -172,13 +176,17 @@ where a.student is not null and a.currid is not null) t where 1=1 ");
{
strSql.Append(" and t.StuNo='" + queryParam["StuNo"].ToString() + "' ");
}
if (!queryParam["EmpNo"].IsEmpty())
{
strSql.Append(" and t.EmpNo like '%" + queryParam["EmpNo"].ToString() + "%' ");
}
if (!queryParam["ClassRoomNo"].IsEmpty())
{
strSql.Append(" and t.ClassRoomNo='" + queryParam["ClassRoomNo"].ToString() + "' ");
}
if (!queryParam["StartTime"].IsEmpty() && !queryParam["EndTime"].IsEmpty())
{
strSql.Append(" AND ( StartDate >= '" + queryParam["StartTime"].ToString() + "' AND StartDate <= '" + queryParam["StartTime"].ToString() + "' ) ");
strSql.Append(" AND ( StartDate >= '" + queryParam["StartTime"].ToString() + "' AND StartDate <= '" + queryParam["EndTime"].ToString() + "' ) ");