|
@@ -229,14 +229,19 @@ namespace TEAMModelFunction
|
|
|
}
|
|
|
if (studentss.IsNotEmpty())
|
|
|
{
|
|
|
- List<string> inidstus = new List<string>();
|
|
|
- studentss.Select(x => x.id).ToList().ForEach(x => { inidstus.Add($"'{x}'"); });
|
|
|
- var insqlstu = string.Join(",", inidstus);
|
|
|
- var querystu = $"SELECT c.id,c.code,c.name,c.picture,c.classId,c.year,c.schoolId FROM c where c.id in ({insqlstu})";
|
|
|
- await foreach (var item in client.GetContainer("TEAMModelOS", "Student").GetItemQueryIterator<StuInfo>(queryText: querystu, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-{school}") }))
|
|
|
- {
|
|
|
- stuInfos.Add(item);
|
|
|
+ var stuGroups = studentss.GroupBy(x => x.code).ToList().Select(x => new { key = x.Key, list = x.ToList() }) ;
|
|
|
+ foreach (var gp in stuGroups) {
|
|
|
+ List<string> inidstus = new List<string>();
|
|
|
+ gp.list.Select(x => x.id).ToList().ForEach(x => { inidstus.Add($"'{x}'"); });
|
|
|
+ PartitionKey partitionKey = new PartitionKey($"Base-{gp.key.Replace("Base-", "")}");
|
|
|
+ var insqlstu = string.Join(",", inidstus);
|
|
|
+ var querystu = $"SELECT c.id,c.code,c.name,c.picture,c.classId,c.year,c.schoolId FROM c where c.id in ({insqlstu})";
|
|
|
+ await foreach (var item in client.GetContainer("TEAMModelOS", "Student").GetItemQueryIterator<StuInfo>(queryText: querystu, requestOptions: new QueryRequestOptions() { PartitionKey= partitionKey }))
|
|
|
+ {
|
|
|
+ stuInfos.Add(item);
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
students.ForEach(x =>
|
|
|
{
|