|
@@ -11,6 +11,7 @@ using System.Threading.Tasks;
|
|
using Azure;
|
|
using Azure;
|
|
using Azure.Cosmos;
|
|
using Azure.Cosmos;
|
|
using Azure.Storage.Sas;
|
|
using Azure.Storage.Sas;
|
|
|
|
+using HTEXLib.COMM.Helpers;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Cryptography.KeyDerivation;
|
|
using Microsoft.AspNetCore.Cryptography.KeyDerivation;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
@@ -1957,9 +1958,11 @@ namespace TEAMModelOS.Controllers
|
|
try
|
|
try
|
|
{
|
|
{
|
|
if (!requert.TryGetProperty("students", out JsonElement students)) return BadRequest();
|
|
if (!requert.TryGetProperty("students", out JsonElement students)) return BadRequest();
|
|
- //if (!requert.TryGetProperty("scope", out JsonElement scope)) return BadRequest();
|
|
|
|
|
|
+ if (!requert.TryGetProperty("tmdIds", out JsonElement tmdIds)) return BadRequest();
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
List<Students> stuList = students.ToObject<List<Students>>();
|
|
List<Students> stuList = students.ToObject<List<Students>>();
|
|
|
|
+ List<string> tmdids = tmdIds.ToObject<List<string>>();
|
|
|
|
+ List<TmdInfo> tmdinfos = new List<TmdInfo>();
|
|
List<object> stus = new List<object>();
|
|
List<object> stus = new List<object>();
|
|
foreach (Students stu in stuList) {
|
|
foreach (Students stu in stuList) {
|
|
var query = $"select c.id,c.name,c.picture,c.classId,c.code,c.groupId,c.groupName,c.no from c where c.id = '{stu.id}'";
|
|
var query = $"select c.id,c.name,c.picture,c.classId,c.code,c.groupId,c.groupName,c.no from c where c.id = '{stu.id}'";
|
|
@@ -1974,8 +1977,21 @@ namespace TEAMModelOS.Controllers
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
- return Ok(new { stus });
|
|
|
|
|
|
+ }
|
|
|
|
+ if (tmdids.IsNotEmpty())
|
|
|
|
+ {
|
|
|
|
+
|
|
|
|
+ List<string> inids = new List<string>();
|
|
|
|
+ tmdids.ForEach(x => { inids.Add($"'{x}'"); });
|
|
|
|
+ var insql = string.Join(",", inids);
|
|
|
|
+ var queryslt = $"SELECT value(c) FROM c where c.id in ({insql})";
|
|
|
|
+ await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryIterator<TmdInfo>(queryText: queryslt, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base") }))
|
|
|
|
+ {
|
|
|
|
+ tmdinfos.Add(item);
|
|
|
|
+ }
|
|
|
|
+ //tmdinfos.AddRange(infos);
|
|
|
|
+ }
|
|
|
|
+ return Ok(new { stus, tmdinfos });
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
{
|
|
{
|