|
@@ -1149,18 +1149,38 @@ namespace TEAMModelOS.Controllers
|
|
|
}
|
|
|
if (scope.ToString().Equals("school"))
|
|
|
{
|
|
|
- await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryStreamIteratorQuery(queryDefinition: cosmosDbQuery.CosmosQueryDefinition, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Item-{code}") }))
|
|
|
- {
|
|
|
- using var json = await JsonDocument.ParseAsync(item.Content);
|
|
|
|
|
|
- if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
|
+
|
|
|
+ // var s = client.GetContainer(Constant.TEAMModelOS, Constant.School).GetItemQueryStreamIterator(queryText: "select c.id,c.code,c.repairResource, c.periodId,c.question,c.useCount,c.level,c.field,c.knowledge,c.type,c.option,c.createTime,c.answer,c.explain,c.children,c.score,c.gradeIds,c.subjectId,c.blob,c.scope from c where 1=1 and c.pid = null and c.subjectId in ( '8b94c6b6-2572-41e5-89b9-a82fcf13891e' ) Order By c.createTime DESC ",
|
|
|
+ var s = client.GetContainer(Constant.TEAMModelOS, Constant.School).GetItemQueryStreamIterator(queryDefinition:cosmosDbQuery.CosmosQueryDefinition ,
|
|
|
+ requestOptions: new QueryRequestOptions() { PartitionKey= new PartitionKey("Item-hbcn") });
|
|
|
+ while (s.HasMoreResults) {
|
|
|
+ var response = await s.ReadNextAsync();
|
|
|
+ if (response.Content!=null)
|
|
|
{
|
|
|
- foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
|
|
|
+ using var json = await JsonDocument.ParseAsync(response.Content);
|
|
|
+
|
|
|
+ if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
|
{
|
|
|
- items.Add(obj.ToObject<object>());
|
|
|
+ foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
|
|
|
+ {
|
|
|
+ items.Add(obj.ToObject<object>());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryStreamIteratorQuery(queryDefinition: cosmosDbQuery.CosmosQueryDefinition, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Item-{code}") }))
|
|
|
+ //{
|
|
|
+ // using var json = await JsonDocument.ParseAsync(item.Content);
|
|
|
+
|
|
|
+ // if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
|
+ // {
|
|
|
+ // foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
|
|
|
+ // {
|
|
|
+ // items.Add(obj.ToObject<object>());
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //}
|
|
|
}
|
|
|
//ResponseBuilder builder = ResponseBuilder.custom();
|
|
|
/* List<ItemInfo> items = new List<ItemInfo>();
|