|
@@ -54,10 +54,14 @@ namespace TEAMModelOS.Controllers.Syllabus
|
|
|
ClassroomStudent classroomStudent = await azureCosmosDBRepository.FindById<ClassroomStudent>(data.classroomCode);
|
|
|
if (classroomStudent == null)
|
|
|
{
|
|
|
- classroomStudent = new ClassroomStudent { id = data.classroomCode, scopeCode = data.schoolCode, studentId = new HashSet<string> { data.studentId } };
|
|
|
+ classroomStudent = new ClassroomStudent { id = data.classroomCode, scopeCode = data.schoolCode, studentId = new List<string> { data.studentId } };
|
|
|
}
|
|
|
else {
|
|
|
- classroomStudent.studentId.UnionWith(new List<string> { data.studentId });
|
|
|
+ if (!classroomStudent.studentId.Contains(data.studentId))
|
|
|
+ {
|
|
|
+ classroomStudent.studentId.Add(data.studentId);
|
|
|
+ }
|
|
|
+ // classroomStudent.studentId.UnionWith(new List<string> { data.studentId });
|
|
|
}
|
|
|
await azureCosmosDBRepository.SaveOrUpdate(classroomStudent);
|
|
|
return builder.Data(data).build();
|
|
@@ -106,14 +110,18 @@ namespace TEAMModelOS.Controllers.Syllabus
|
|
|
ClassroomStudent classroomStudent = await azureCosmosDBRepository.FindById<ClassroomStudent>(classroom.Key);
|
|
|
if (classroomStudent == null)
|
|
|
{
|
|
|
- classroomStudent = new ClassroomStudent { id = classroom.Key,studentId= new HashSet<string>()};
|
|
|
+ classroomStudent = new ClassroomStudent { id = classroom.Key,studentId= new List<string>()};
|
|
|
}
|
|
|
foreach (var classroomStudent1 in classroom)
|
|
|
{
|
|
|
classroomStudent.scopeCode = classroomStudent1.schoolCode;
|
|
|
- classroomStudent.studentId.UnionWith(new List<string> { classroomStudent1.studentId });
|
|
|
+ if (!classroomStudent.studentId.Contains(classroomStudent1.studentId))
|
|
|
+ {
|
|
|
+ classroomStudent.studentId.Add(classroomStudent1.studentId);
|
|
|
+ }
|
|
|
+ // classroomStudent.studentId.UnionWith(new List<string> { classroomStudent1.studentId });
|
|
|
}
|
|
|
- classroomStudents.AddRange(classroomStudents);
|
|
|
+ classroomStudents.Add(classroomStudent);
|
|
|
}
|
|
|
await azureCosmosDBRepository.SaveOrUpdateAll(classroomStudents);
|
|
|
builder.Data(students);
|
|
@@ -179,11 +187,14 @@ namespace TEAMModelOS.Controllers.Syllabus
|
|
|
ClassroomStudent classroomStudent = await azureCosmosDBRepository.FindById<ClassroomStudent>(data.classroomCode);
|
|
|
if (classroomStudent == null)
|
|
|
{
|
|
|
- classroomStudent = new ClassroomStudent { id = data.classroomCode, scopeCode = data.schoolCode, studentId = new HashSet<string> { data.studentId } };
|
|
|
+ classroomStudent = new ClassroomStudent { id = data.classroomCode, scopeCode = data.schoolCode, studentId = new List<string> { data.studentId } };
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- classroomStudent.studentId.UnionWith(new List<string> { data.studentId });
|
|
|
+ if (!classroomStudent.studentId.Contains(data.studentId)) {
|
|
|
+ classroomStudent.studentId.Add(data.studentId);
|
|
|
+ }
|
|
|
+ // classroomStudent.studentId.UnionWith(new List<string> { data.studentId });
|
|
|
}
|
|
|
await azureCosmosDBRepository.SaveOrUpdate(classroomStudent);
|
|
|
return builder.Data(data).build();
|
|
@@ -217,7 +228,8 @@ namespace TEAMModelOS.Controllers.Syllabus
|
|
|
ClassroomStudent classroomStudent = await azureCosmosDBRepository.FindById<ClassroomStudent>(student.classroomCode);
|
|
|
if (classroomStudent != null)
|
|
|
{
|
|
|
- classroomStudent.studentId.ExceptWith(new List<string> { student.studentId });
|
|
|
+ classroomStudent.studentId.Remove(student.studentId);
|
|
|
+ //classroomStudent.studentId.ExceptWith(new List<string> { student.studentId });
|
|
|
await azureCosmosDBRepository.SaveOrUpdate(classroomStudent);
|
|
|
}
|
|
|
return builder.Data(data).build();
|
|
@@ -233,7 +245,7 @@ namespace TEAMModelOS.Controllers.Syllabus
|
|
|
List<Student> students= await azureCosmosDBRepository.FindByDict<Student>(request.@params);
|
|
|
await azureCosmosDBRepository.DeleteAll<Student>(students);
|
|
|
///更新学生关系表
|
|
|
- List<ClassroomStudent> classroomStudents = new List<ClassroomStudent>();
|
|
|
+ // List<ClassroomStudent> classroomStudents = new List<ClassroomStudent>();
|
|
|
foreach (var classroom in students.GroupBy(x => x.classroomCode).ToList())
|
|
|
{
|
|
|
|
|
@@ -243,10 +255,11 @@ namespace TEAMModelOS.Controllers.Syllabus
|
|
|
foreach (var classroomStudent1 in classroom)
|
|
|
{
|
|
|
classroomStudent.scopeCode = classroomStudent1.schoolCode;
|
|
|
- classroomStudent.studentId.ExceptWith(new List<string> { classroomStudent1.studentId });
|
|
|
+ // classroomStudent.studentId.ExceptWith(new List<string> { classroomStudent1.studentId });
|
|
|
+ classroomStudent.studentId.Remove(classroomStudent1.studentId);
|
|
|
}
|
|
|
- classroomStudents.AddRange(classroomStudents);
|
|
|
- await azureCosmosDBRepository.SaveOrUpdateAll(classroomStudents);
|
|
|
+ // classroomStudents.AddRange(classroomStudents);
|
|
|
+ await azureCosmosDBRepository.SaveOrUpdate(classroomStudent);
|
|
|
}
|
|
|
}
|
|
|
return builder.build();
|