|
@@ -200,7 +200,7 @@ namespace TEAMModelOS.Controllers.Common
|
|
{
|
|
{
|
|
if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
- var query = $"select c.id,c.name,c.createTime from c ";
|
|
|
|
|
|
+ var query = $"select c.id,c.name,c.createTime from c where (c.status<>-1 or IS_DEFINED(c.status) = false ) ";
|
|
string continuationToken = string.Empty;
|
|
string continuationToken = string.Empty;
|
|
string token = default;
|
|
string token = default;
|
|
//是否需要进行分页查询,默认不分页
|
|
//是否需要进行分页查询,默认不分页
|
|
@@ -261,7 +261,7 @@ namespace TEAMModelOS.Controllers.Common
|
|
if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
List<Homework> works = new();
|
|
List<Homework> works = new();
|
|
- await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryIterator<Homework>(queryText: $"select value(c) from c where c.id = '{id}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Homework-{code}") }))
|
|
|
|
|
|
+ await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryIterator<Homework>(queryText: $"select value(c) from c where (c.status<>-1 or IS_DEFINED(c.status) = false ) and c.id = '{id}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Homework-{code}") }))
|
|
{
|
|
{
|
|
works.Add(item);
|
|
works.Add(item);
|
|
}
|
|
}
|
|
@@ -289,7 +289,7 @@ namespace TEAMModelOS.Controllers.Common
|
|
if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
if (!requert.TryGetProperty("code", out JsonElement code)) return BadRequest();
|
|
if (!requert.TryGetProperty("tId", out JsonElement tId)) return BadRequest();
|
|
if (!requert.TryGetProperty("tId", out JsonElement tId)) return BadRequest();
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
- var query = $"select c.id,c.name,c.createTime,A0.time from c join A0 in c.teachers where A0.id = '{tId}'";
|
|
|
|
|
|
+ var query = $"select c.id,c.name,c.createTime,A0.time from c join A0 in c.teachers where (c.status<>-1 or IS_DEFINED(c.status) = false ) and A0.id = '{tId}'";
|
|
List<object> works = new();
|
|
List<object> works = new();
|
|
await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Homework-{code}") }))
|
|
await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: query, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Homework-{code}") }))
|
|
{
|
|
{
|
|
@@ -326,7 +326,7 @@ namespace TEAMModelOS.Controllers.Common
|
|
if (!requert.TryGetProperty("tId", out JsonElement tId)) return BadRequest();
|
|
if (!requert.TryGetProperty("tId", out JsonElement tId)) return BadRequest();
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
List<object> works = new();
|
|
List<object> works = new();
|
|
- await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: $"select value(c) from c join A0 in c.teachers where A0.id = '{tId}' and c.id = '{id}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Homework-{code}") }))
|
|
|
|
|
|
+ await foreach (var item in client.GetContainer("TEAMModelOS", "Common").GetItemQueryStreamIterator(queryText: $"select value(c) from c join A0 in c.teachers where (c.status<>-1 or IS_DEFINED(c.status) = false ) and A0.id = '{tId}' and c.id = '{id}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Homework-{code}") }))
|
|
{
|
|
{
|
|
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)
|