|
|
@@ -2245,7 +2245,7 @@ where StuNo not in(Select StuNo from stuscore s where s.Academicyearno = sl.Acad |
|
|
|
tableName = queryParam["TableName"].ToString(); |
|
|
|
} |
|
|
|
var strSql = new StringBuilder(); |
|
|
|
strSql.Append(" select bb.AcademicYearNo,bb.Semester,bb.LessonSortNo,bb.LessonNo,bb.LessonName,bb.StuNo,bb.StuName,bb.MajorNo,bb.ClassNo,li.StudyScore,ls.LessonSortName,lt.LessonTypeName,bb.Score,(case when sp.Score>=60 then 60 else sp.score end) as ScoreOfNotPass,(case when spt.Score>=60 then 60 else spt.Score end) as ScoreOfNotPassTwo,cm.MajorName,ci.ClassName "); |
|
|
|
strSql.Append(" select bb.Grade,bb.AcademicYearNo,bb.Semester,bb.LessonSortNo,bb.LessonNo,bb.LessonName,bb.StuNo,bb.StuName,bb.MajorNo,bb.ClassNo,li.StudyScore,ls.LessonSortName,lt.LessonTypeName,bb.Score,(case when sp.Score>=60 then 60 else sp.score end) as ScoreOfNotPass,(case when spt.Score>=60 then 60 else spt.Score end) as ScoreOfNotPassTwo,cm.MajorName,ci.ClassName "); |
|
|
|
strSql.Append(" from ( "); |
|
|
|
strSql.Append($"select sb.Grade,s.AcademicYearNo,s.Semester,s.LessonSortNo,s.LessonNo,s.LessonName,s.StuNo,sb.StuName,s.MajorNo,s.ClassNo,Max(s.Score) as Score from {tableName} s left join StuInfoBasic sb on s.StuNo=sb.StuNo "); |
|
|
|
strSql.Append(" where 1=1 and s.CheckMark='1' "); |
|
|
@@ -2354,6 +2354,96 @@ where StuNo not in(Select StuNo from stuscore s where s.Academicyearno = sl.Acad |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 根据学号/姓名获取学生成绩列表,带分页 |
|
|
|
/// </summary> |
|
|
|
/// <param name="queryJson"></param> |
|
|
|
/// <returns></returns> |
|
|
|
public IEnumerable<StuScoreEntity> GetScorePageListByStuInfo(Pagination pagination, string queryJson) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
//参考写法 |
|
|
|
var queryParam = queryJson.ToJObject(); |
|
|
|
// 虚拟参数 |
|
|
|
var dp = new DynamicParameters(new { }); |
|
|
|
var tableName = "StuScore"; |
|
|
|
if (!queryParam["TableName"].IsEmpty()) |
|
|
|
{ |
|
|
|
tableName = queryParam["TableName"].ToString(); |
|
|
|
} |
|
|
|
var strSql = new StringBuilder(); |
|
|
|
strSql.Append(" select bb.Grade,bb.AcademicYearNo,bb.Semester,bb.LessonSortNo,bb.LessonNo,bb.LessonName,bb.StuNo,bb.StuName,bb.MajorNo,bb.ClassNo,bb.DeptNo,li.StudyScore,ls.LessonSortName,lt.LessonTypeName,bb.Score,(case when sp.Score>=60 then 60 else sp.score end) as ScoreOfNotPass,(case when spt.Score>=60 then 60 else spt.Score end) as ScoreOfNotPassTwo,cm.MajorName,ci.ClassName "); |
|
|
|
strSql.Append(@" ,(select cc.majorrank from |
|
|
|
(select StuNo, SUM(Score) as totalscore, ROW_NUMBER() over(order by SUM(Score) desc) as majorrank |
|
|
|
from StuScore c where c.CheckMark = '1' and c.LessonSortNo = '1' and c.MajorNo = bb.MajorNo and c.AcademicYearNo = bb.AcademicYearNo and c.Semester = bb.Semester |
|
|
|
group by c.StuNo) cc where cc.StuNo = bb.StuNo) as RankInMajor "); |
|
|
|
strSql.Append(@" ,(select cc.majorrank from |
|
|
|
(select StuNo, SUM(Score) as totalscore, ROW_NUMBER() over(order by SUM(Score) desc) as majorrank |
|
|
|
from StuScore c where c.CheckMark = '1' and c.LessonSortNo = '1' and c.ClassNo = bb.ClassNo and c.AcademicYearNo = bb.AcademicYearNo and c.Semester = bb.Semester |
|
|
|
group by c.StuNo) cc where cc.StuNo = bb.StuNo) as RankInClass "); |
|
|
|
strSql.Append(@" ,(select cc.majorrank from |
|
|
|
(select StuNo, SUM(Score) as totalscore, ROW_NUMBER() over(order by SUM(Score) desc) as majorrank |
|
|
|
from StuScore c where c.CheckMark = '1' and c.LessonSortNo = '1' and c.DeptNo = bb.DeptNo and c.AcademicYearNo = bb.AcademicYearNo and c.Semester = bb.Semester |
|
|
|
group by c.StuNo) cc where cc.StuNo = bb.StuNo) as RankIndept "); |
|
|
|
strSql.Append(" from ( "); |
|
|
|
strSql.Append($"select sb.Grade,s.AcademicYearNo,s.Semester,s.LessonSortNo,s.LessonNo,s.LessonName,s.StuNo,sb.StuName,s.MajorNo,s.ClassNo,s.DeptNo,Max(s.Score) as Score from {tableName} s left join StuInfoBasic sb on s.StuNo=sb.StuNo "); |
|
|
|
strSql.Append(" where 1=1 and s.CheckMark='1' "); |
|
|
|
if (!queryParam["AcademicYearNo"].IsEmpty()) |
|
|
|
{ |
|
|
|
dp.Add("AcademicYearNo", queryParam["AcademicYearNo"].ToString(), DbType.String); |
|
|
|
strSql.Append(" and s.AcademicYearNo=@AcademicYearNo "); |
|
|
|
} |
|
|
|
if (!queryParam["Semester"].IsEmpty()) |
|
|
|
{ |
|
|
|
dp.Add("Semester", queryParam["Semester"].ToString(), DbType.String); |
|
|
|
strSql.Append(" and s.Semester=@Semester "); |
|
|
|
} |
|
|
|
if (!queryParam["StuNo"].IsEmpty()) |
|
|
|
{ |
|
|
|
dp.Add("StuNo", queryParam["StuNo"].ToString(), DbType.String); |
|
|
|
strSql.Append(" and s.StuNo=@StuNo "); |
|
|
|
} |
|
|
|
if (!queryParam["StuName"].IsEmpty()) |
|
|
|
{ |
|
|
|
dp.Add("StuName", queryParam["StuName"].ToString(), DbType.String); |
|
|
|
strSql.Append(" and s.StuName=@StuName "); |
|
|
|
} |
|
|
|
if (!queryParam["LessonNo"].IsEmpty()) |
|
|
|
{ |
|
|
|
dp.Add("LessonNo", queryParam["LessonNo"].ToString(), DbType.String); |
|
|
|
strSql.Append(" and s.LessonNo=@LessonNo "); |
|
|
|
} |
|
|
|
if (!queryParam["Grade"].IsEmpty()) |
|
|
|
{ |
|
|
|
dp.Add("Grade", queryParam["Grade"].ToString(), DbType.String); |
|
|
|
strSql.Append(" and sb.Grade=@Grade "); |
|
|
|
} |
|
|
|
strSql.Append(" group by sb.Grade,s.AcademicYearNo,s.Semester,s.LessonSortNo,s.LessonNo,s.LessonName,s.StuNo,sb.StuName,s.MajorNo,s.ClassNo,s.DeptNo ) as bb "); |
|
|
|
strSql.Append(" left join StuScoreNotPass sp on bb.AcademicYearNo=sp.AcademicYearNo and bb.Semester=sp.Semester and bb.LessonSortNo=sp.LessonSortNo and bb.LessonNo=sp.LessonNo and bb.LessonName=sp.LessonName and bb.StuNo=sp.StuNo and sp.CheckMark = '1' "); |
|
|
|
strSql.Append(" left join StuScoreNotPassTwo spt on bb.AcademicYearNo=spt.AcademicYearNo and bb.Semester=spt.Semester and bb.LessonSortNo=spt.LessonSortNo and bb.LessonNo=spt.LessonNo and bb.LessonName=spt.LessonName and bb.StuNo=spt.StuNo and spt.CheckMark = '1' "); |
|
|
|
strSql.Append(" left join CdLessonSort ls on bb.LessonSortNo= ls.LessonSortNo "); |
|
|
|
strSql.Append(" left join LessonInfo li on bb.LessonNo= li.LessonNo and li.CheckMark='1' "); |
|
|
|
strSql.Append(" left join CdMajor cm on bb.MajorNo= cm.MajorNo and cm.CheckMark='1' "); |
|
|
|
strSql.Append(" left join ClassInfo ci on bb.ClassNo= ci.ClassNo and ci.CheckMark='1' "); |
|
|
|
strSql.Append(" left join CdLessonType lt on li.LessonTypeId=lt.ltid and lt.LTEnabled='1' "); |
|
|
|
|
|
|
|
var result = this.BaseRepository("CollegeMIS").FindList<StuScoreEntity>(strSql.ToString(), dp, pagination); |
|
|
|
return result; |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
if (ex is ExceptionEx) |
|
|
|
{ |
|
|
|
throw; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
throw ExceptionEx.ThrowServiceException(ex); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// 根据学号/姓名获取学生成绩列表 |
|
|
@@ -2909,13 +2999,13 @@ where StuNo not in(Select StuNo from stuscore s where s.Academicyearno = sl.Acad |
|
|
|
var kclx = queryParam["LessonType"].ToString(); |
|
|
|
sql = sql + $" and d.LTId='{kclx}' "; |
|
|
|
} |
|
|
|
var ls = this.BaseRepository("CollegeMIS").FindList<StuScoreEntity>(sql).GroupBy(x => new { x.ClassNo, x.LessonNo }).Select(x => new StuScoreEntity { ClassNo = x.Key.ClassNo, LessonNo = x.Key.LessonNo, LessonName = x.FirstOrDefault().LessonName, AcademicYearNo = x.FirstOrDefault().AcademicYearNo, Semester = x.FirstOrDefault().Semester, DeptNo = x.FirstOrDefault().DeptNo, Grade = x.FirstOrDefault().Grade, LessonTypeName = x.FirstOrDefault().LessonTypeName, EmpName = x.FirstOrDefault().EmpName, EmpNo = x.FirstOrDefault().EmpNo, ModifyUserId = x.FirstOrDefault().ModifyUserId, ModifyUserName = x.FirstOrDefault().ModifyUserName, LessonTypeId=x.FirstOrDefault().LessonTypeId,ScoreId=x.FirstOrDefault().ScoreId, CheckMark = x.All(a => a.CheckMark == "1") ? "1" : "0" }); |
|
|
|
var ls = this.BaseRepository("CollegeMIS").FindList<StuScoreEntity>(sql).GroupBy(x => new { x.ClassNo, x.LessonNo }).Select(x => new StuScoreEntity { ClassNo = x.Key.ClassNo, LessonNo = x.Key.LessonNo, LessonName = x.FirstOrDefault().LessonName, AcademicYearNo = x.FirstOrDefault().AcademicYearNo, Semester = x.FirstOrDefault().Semester, DeptNo = x.FirstOrDefault().DeptNo, Grade = x.FirstOrDefault().Grade, LessonTypeName = x.FirstOrDefault().LessonTypeName, EmpName = x.FirstOrDefault().EmpName, EmpNo = x.FirstOrDefault().EmpNo, ModifyUserId = x.FirstOrDefault().ModifyUserId, ModifyUserName = x.FirstOrDefault().ModifyUserName, LessonTypeId = x.FirstOrDefault().LessonTypeId, ScoreId = x.FirstOrDefault().ScoreId, CheckMark = x.All(a => a.CheckMark == "1") ? "1" : "0" }); |
|
|
|
|
|
|
|
|
|
|
|
if (!queryParam["Stat"].IsEmpty()) |
|
|
|
{ |
|
|
|
var zt = queryParam["Stat"].ToString(); |
|
|
|
ls=ls.Where(x=>x.CheckMark==zt); |
|
|
|
ls = ls.Where(x => x.CheckMark == zt); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|