var list = this.BaseRepository("CollegeMIS").FindList<OpenLessonPlanOfElectiveEntity>($"select * from OpenLessonPlanOfElective where Id in ('{keyValue}')");
var list = db.FindList<OpenLessonPlanOfElectiveEntity>($"select * from OpenLessonPlanOfElective where Id in ('{keyValue}')");
foreach (var entity in list)
{
var lessonSectionArr = entity.LessonSection.Split(',');
var lessonTimeArr = entity.LessonTime.Split(',');
//选修课课程异动
db.ExecuteBySql($"delete from OpenLessonPlanOfElectiveChange where OLPEId='{entity.Id}'");
for (int i = 0; i < lessonSectionArr.Length; i++)
{
//合班历史记录
db.ExecuteBySql(
$@"delete from OpenLessonPlanOfElectiveDel where AcademicYearNo='{entity.AcademicYearNo}' and Semester='{entity.Semester}' and LessonNo='{entity.LessonNo}'
and empno = '{entity.EmpNo}' and ClassRoomNo = '{entity.ClassRoomNo}'
and LessonTime = '{lessonTimeArr[i]}' and LessonSection = '{lessonSectionArr[i]}'");
//选修课排课
db.ExecuteBySql(
$@"delete from ArrangeLessonTermOfElective where AcademicYearNo='{entity.AcademicYearNo}' and Semester='{entity.Semester}' and LessonNo='{entity.LessonNo}'
and empno = '{entity.EmpNo}' and ClassRoomNo = '{entity.ClassRoomNo}'
and LessonTime = '{lessonTimeArr[i]}' and LessonSection = '{lessonSectionArr[i]}'");
}
//选课专业
db.ExecuteBySql($"delete from ElectiveMajor where OLPEId='{entity.Id}'");
//删除选修课课程表
db.ExecuteBySql($"delete from OpenLessonPlanOfElective where Id='{entity.Id}'");