|
@@ -3475,6 +3475,19 @@ namespace TEAMModelOS.Controllers
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
//var queryTeacher = $"select value(c) from c where c.stuId = '{stuId}' and c.school = '{code}' and c.subjectId = '{subjectId}'";
|
|
|
List<ErrorItems> errorItems = new();
|
|
|
+ List<string> ids = new();
|
|
|
+ await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryStreamIterator(queryText: $"select A0.id from c join A0 in c.its where c.stuId = '{stuId}' and c.subjectId = '{subjectId}' ", requestOptions: new QueryRequestOptions() {PartitionKey = new PartitionKey($"{pk}") }))
|
|
|
+ {
|
|
|
+ using var json = await JsonDocument.ParseAsync(item.ContentStream);
|
|
|
+ if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
|
+ {
|
|
|
+ foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
|
|
|
+ {
|
|
|
+ ids.Add(obj.GetProperty("id").ToString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryStreamIterator(queryText: stringBuilder.ToString(), continuationToken: token, requestOptions: new QueryRequestOptions() {MaxItemCount = topcout, PartitionKey = new PartitionKey($"{pk}") }))
|
|
|
{
|
|
|
using var json = await JsonDocument.ParseAsync(item.ContentStream);
|
|
@@ -3491,7 +3504,7 @@ namespace TEAMModelOS.Controllers
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- return Ok(new { errorItems, token });
|
|
|
+ return Ok(new { errorItems, token, ids.Count });
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|