strSql.Append(@"select b.*,c.StuNo,c.StuName,c.Status,cp.Status as StatusPre from ElectiveMajor a left join OpenLessonPlanOfElective b on a.OLPOEId=b.Id
left join StuSelectLessonListOfElective c on b.Id=c.OLPEId and c.StuNo=@StuNo
left join StuSelectLessonListOfElectivePre cp on b.Id=cp.OLPEId and cp.StuNo=@StuNo
where 1=1 and a.MajorId is not null and a.Grade is not null ");
var EADateArrangeEntityAboutElective = this.BaseRepository("CollegeMIS").FindEntity<EADateArrangeEntity>(x => x.WorkName == "选课" && x.MakeDate <= now && x.EndDate >= now && x.CheckMark == "1");
var strSql = new StringBuilder();
strSql.Append(@"select b.*,c.StuNo,c.StuName,c.Status,cp.Status as StatusPre from ElectiveMajor a left join OpenLessonPlanOfElective b on a.OLPOEId=b.Id
left join StuSelectLessonListOfElective c on b.Id=c.OLPEId and c.StuNo=@StuNo
left join StuSelectLessonListOfElectivePre cp on b.Id=cp.OLPEId and cp.StuNo=@StuNo
where not exists ( ");
//不显示与已选课程 相同课程名称相同教师的课程
strSql.Append(" select * from StuSelectLessonListOfElective s where s.AcademicYearNo='" + EADateArrangeEntityAboutElective?.AcademicYearNo + "' and s.Semester='" + EADateArrangeEntityAboutElective.Semester + "' and s.StuNo=@StuNo and s.Status <>3 and s.LessonName=b.LessonName and s.EmpNo=b.EmpNo and s.OLPEId!=b.Id ");
strSql.Append(" ) ");
strSql.Append(" and a.MajorId is not null and a.Grade is not null ");
strSql.Append(" AND b.AcademicYearNo='" + EADateArrangeEntityAboutElective?.AcademicYearNo + "' and b.Semester='" + EADateArrangeEntityAboutElective?.Semester + "' ");
var EADateArrangeEntityAboutElective = this.BaseRepository("CollegeMIS").FindEntity<EADateArrangeEntity>(x => x.WorkName == "选课" && x.MakeDate <= now && x.EndDate >= now && x.CheckMark == "1");
if (EADateArrangeEntityAboutElective != null)
{
strSql.Append(" AND b.AcademicYearNo='" + EADateArrangeEntityAboutElective?.AcademicYearNo + "' and b.Semester='" + EADateArrangeEntityAboutElective?.Semester + "'");
strSql.Append(" and b.LessonName not in(select LessonName from StuSelectLessonListOfElective where AcademicYearNo='" + EADateArrangeEntityAboutElective?.AcademicYearNo + "' and Semester='" + EADateArrangeEntityAboutElective?.Semester + "' and StuNo='" + queryParam["StuNo"].ToString() + "' and Status<>3)");
}
else
{
strSql.Append(" AND b.AcademicYearNo='' and b.Semester=''");
}
//不显示与已选课程 相同课程名称的课程
//if (EADateArrangeEntityAboutElective != null)
//{
// strSql.Append(" AND b.AcademicYearNo='" + EADateArrangeEntityAboutElective?.AcademicYearNo + "' and b.Semester='" + EADateArrangeEntityAboutElective?.Semester + "'");
// strSql.Append(" and b.LessonName not in(select LessonName from StuSelectLessonListOfElective where AcademicYearNo='" + EADateArrangeEntityAboutElective?.AcademicYearNo + "' and Semester='" + EADateArrangeEntityAboutElective?.Semester + "' and StuNo='" + queryParam["StuNo"].ToString() + "' and Status<>3)");
//}
//else
//{
// strSql.Append(" AND b.AcademicYearNo='' and b.Semester=''");