|
@@ -34,7 +34,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
- /// 查询试卷的数量统计
|
|
|
+ /// 查询试卷的数量统计集合
|
|
|
/// </summary>
|
|
|
/// <param name="jsonElement"></param>
|
|
|
/// <returns></returns>
|
|
@@ -91,7 +91,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
else
|
|
|
{
|
|
|
long tempTotal = 0;
|
|
|
- await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", "School").GetItemQueryStreamIterator(queryText: $"select c.id from c where c.pk='Item'", requestOptions: new QueryRequestOptions() { }))
|
|
|
+ await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", "School").GetItemQueryStreamIterator(queryText: $"select c.id from c where c.pk='Paper'", requestOptions: new QueryRequestOptions() { }))
|
|
|
{
|
|
|
using var json = await JsonDocument.ParseAsync(item.ContentStream);
|
|
|
if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetInt64() > 0)
|
|
@@ -115,12 +115,18 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
{
|
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
|
long total = 0;
|
|
|
- await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", "School").GetItemQueryStreamIterator(queryText: $"select c.id from c where c.pk='Item'", requestOptions: new QueryRequestOptions() { }))
|
|
|
+ //string sqlText = $"select c.id from c where c.pk='Paper'";
|
|
|
+ string sqlText = $"select COUNT(c.id) AS totals from c where c.pk='Paper'";
|
|
|
+ await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", "School").GetItemQueryStreamIterator(queryText: sqlText, requestOptions: new QueryRequestOptions() { }))
|
|
|
{
|
|
|
using var json = await JsonDocument.ParseAsync(item.ContentStream);
|
|
|
if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetInt64() > 0)
|
|
|
{
|
|
|
- total += count.GetInt64();
|
|
|
+ //total += count.GetInt64();
|
|
|
+ foreach (var obj in json.RootElement.GetProperty("Documents").EnumerateArray())
|
|
|
+ {
|
|
|
+ total += obj.GetProperty("totals").GetInt64();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|