|
@@ -835,6 +835,7 @@ namespace TEAMModelOS.Controllers
|
|
//if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
//if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
if (!requert.TryGetProperty("studentId", out JsonElement studentId)) return BadRequest();
|
|
if (!requert.TryGetProperty("studentId", out JsonElement studentId)) return BadRequest();
|
|
if (!requert.TryGetProperty("code", out JsonElement school)) return BadRequest();
|
|
if (!requert.TryGetProperty("code", out JsonElement school)) return BadRequest();
|
|
|
|
+ if(!requert.TryGetProperty("scode", out JsonElement scode)) return BadRequest();
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
var query = $"select c.id,c.code,A0.id paperId,A0.code paperCode,A0.name paperName,A0.multipleRule,A0.scope,A0.blob from c join A0 in c.papers where c.id ='{id}'";
|
|
var query = $"select c.id,c.code,A0.id paperId,A0.code paperCode,A0.name paperName,A0.multipleRule,A0.scope,A0.blob from c join A0 in c.papers where c.id ='{id}'";
|
|
List<object> papers = new List<object>();
|
|
List<object> papers = new List<object>();
|
|
@@ -873,7 +874,7 @@ namespace TEAMModelOS.Controllers
|
|
}
|
|
}
|
|
}
|
|
}
|
|
var queryClassId = $"select c.targetClassIds id from c where c.id ='{id}'";
|
|
var queryClassId = $"select c.targetClassIds id from c where c.id ='{id}'";
|
|
- await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: queryClassId, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Exam-{school}") }))
|
|
|
|
|
|
+ await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: queryClassId, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"{scode}") }))
|
|
{
|
|
{
|
|
using var json = await JsonDocument.ParseAsync(item.ContentStream);
|
|
using var json = await JsonDocument.ParseAsync(item.ContentStream);
|
|
if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
@@ -895,7 +896,7 @@ namespace TEAMModelOS.Controllers
|
|
infoIds.Add(ids);
|
|
infoIds.Add(ids);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Exam-{school}") }))
|
|
|
|
|
|
+ await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"{scode}") }))
|
|
{
|
|
{
|
|
using var json = await JsonDocument.ParseAsync(item.ContentStream);
|
|
using var json = await JsonDocument.ParseAsync(item.ContentStream);
|
|
if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
@@ -908,7 +909,7 @@ namespace TEAMModelOS.Controllers
|
|
}
|
|
}
|
|
var querySubject = $"select A0.id,A0.name from c join A0 in c.subjects where c.id ='{id}'";
|
|
var querySubject = $"select A0.id,A0.name from c join A0 in c.subjects where c.id ='{id}'";
|
|
//List<object> props = new List<object>();
|
|
//List<object> props = new List<object>();
|
|
- await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: querySubject, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Exam-{school}") }))
|
|
|
|
|
|
+ await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: querySubject, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"{scode}") }))
|
|
{
|
|
{
|
|
using var json = await JsonDocument.ParseAsync(item.ContentStream);
|
|
using var json = await JsonDocument.ParseAsync(item.ContentStream);
|
|
if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|