|
@@ -107,11 +107,27 @@ namespace TEAMModelOS.Controllers
|
|
|
if (teachers.IsNotEmpty())
|
|
|
{
|
|
|
List<IdNameCode> groupLists = new List<IdNameCode>();
|
|
|
- await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIteratorSql<IdNameCode>
|
|
|
- (queryText: $"SELECT c.id, c.name, m.id as code FROM c join m in c.members where c.type='research' and m.id in ({string.Join(",", teachers.Select(x => $"'{x.id}'"))}) ",
|
|
|
+ await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryStreamIteratorSql
|
|
|
+ (queryText: $"SELECT c.id, c.name, c.year, m.id as code FROM c join m in c.members where c.type='research' and m.id in ({string.Join(",", teachers.Select(x => $"'{x.id}'"))}) ",
|
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"GroupList-{school_code}") }))
|
|
|
{
|
|
|
- groupLists.Add(item);
|
|
|
+ using var json = await JsonDocument.ParseAsync(item.Content);
|
|
|
+ if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
|
+ {
|
|
|
+ var accounts = json.RootElement.GetProperty("Documents").EnumerateArray();
|
|
|
+ while (accounts.MoveNext())
|
|
|
+ {
|
|
|
+ JsonElement account = accounts.Current;
|
|
|
+ groupLists.Add(account.ToObject<IdNameCode>());
|
|
|
+ teachers.ForEach(x => {
|
|
|
+ if (account.TryGetProperty("year", out JsonElement year))
|
|
|
+ {
|
|
|
+ x.year = year.GetInt32();
|
|
|
+ }
|
|
|
+
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
if (groupLists.IsNotEmpty())
|
|
|
{
|
|
@@ -427,6 +443,7 @@ namespace TEAMModelOS.Controllers
|
|
|
public string phone { get; set; }
|
|
|
public string email { get; set; }
|
|
|
public List<TEAMModelOS.SDK.Models.Teacher.TeacherArea> areas { get; set; } = new List<TEAMModelOS.SDK.Models.Teacher.TeacherArea>();
|
|
|
+ public int year { get; set; }
|
|
|
|
|
|
}
|
|
|
/// <summary>
|