|
@@ -394,11 +394,13 @@ namespace TEAMModelOS.Controllers
|
|
|
try
|
|
|
{
|
|
|
var client = _azureCosmos.GetCosmosClient();
|
|
|
+ List<object> stus = new List<object>();
|
|
|
List<string> stuIds = new List<string>();
|
|
|
+ List<(string id, string name, string pic, string code,string classId,string groupId,string groupName,string no)> listStudent = new List<(string id, string name, string pic, string code, string classId, string groupId, string groupName, string no)>();
|
|
|
for (int i = 0; i < ids.GetArrayLength(); i++)
|
|
|
{
|
|
|
await foreach (var item in client.GetContainer("TEAMModelOS", "Student").GetItemQueryStreamIterator(
|
|
|
- queryText: $"select c.id from c where c.classId = '{ids[i].GetString()}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-{schoolId}") }))
|
|
|
+ queryText: $"select c.id,c.name,c.classId,c.code,c.groupId,c.groupName,c.no,c.picture from c where c.classId = '{ids[i].GetString()}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-{schoolId}") }))
|
|
|
{
|
|
|
using var json = await JsonDocument.ParseAsync(item.ContentStream);
|
|
|
if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
@@ -408,12 +410,19 @@ namespace TEAMModelOS.Controllers
|
|
|
{
|
|
|
JsonElement account = accounts.Current;
|
|
|
stuIds.Add(account.GetProperty("id").GetString());
|
|
|
+ listStudent.Add((account.GetProperty("id").GetString(),
|
|
|
+ account.GetProperty("name").GetString(),
|
|
|
+ account.GetProperty("classId").GetString(),
|
|
|
+ account.GetProperty("code").GetString(),
|
|
|
+ account.GetProperty("groupId").GetString(),
|
|
|
+ account.GetProperty("groupName").GetString(),
|
|
|
+ account.GetProperty("no").GetString(),
|
|
|
+ account.GetProperty("picture").GetString()));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (scope.ToString().Equals("school", StringComparison.OrdinalIgnoreCase))
|
|
|
{
|
|
|
-
|
|
|
List<StuList> stuLists = new List<StuList>();
|
|
|
await foreach (var item in client.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<StuList>(queryText: $"select value(c) from c where c.id = '{ids[i].GetString()}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"StuList-{schoolId}") }))
|
|
|
{
|
|
@@ -429,59 +438,106 @@ namespace TEAMModelOS.Controllers
|
|
|
{
|
|
|
if (!stuIds.Contains(stu.id))
|
|
|
{
|
|
|
- stuIds.Add(stu.id);
|
|
|
+ listStudent.Add((stu.id,
|
|
|
+ default,
|
|
|
+ default,
|
|
|
+ stu.code,
|
|
|
+ default,
|
|
|
+ default,
|
|
|
+ default,
|
|
|
+ default));
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- stuIds.Add(stu.id);
|
|
|
+ listStudent.Add((stu.id,
|
|
|
+ default,
|
|
|
+ default,
|
|
|
+ stu.code,
|
|
|
+ default,
|
|
|
+ default,
|
|
|
+ default,
|
|
|
+ default));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- else
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ //处理发布对象为自选名单(个人)
|
|
|
+ List<StuList> stuLists1 = new List<StuList>();
|
|
|
+ await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryIterator<StuList>(queryText: $"select value(c) from c where c.id = '{ids[i].GetString()}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"StuList") }))
|
|
|
{
|
|
|
- //处理发布对象为自选名单(个人)
|
|
|
- List<StuList> stuLists1 = new List<StuList>();
|
|
|
- await foreach (var item in client.GetContainer("TEAMModelOS", "Teacher").GetItemQueryIterator<StuList>(queryText: $"select value(c) from c where c.id = '{ids[i].GetString()}'", requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"StuList") }))
|
|
|
- {
|
|
|
- stuLists1.Add(item);
|
|
|
- }
|
|
|
- if (stuLists.Count > 0)
|
|
|
+ stuLists1.Add(item);
|
|
|
+ }
|
|
|
+ if (stuLists1.Count > 0)
|
|
|
+ {
|
|
|
+ foreach (StuList stuList in stuLists1)
|
|
|
{
|
|
|
- foreach (StuList stuList in stuLists)
|
|
|
+ foreach (Students students in stuList.students)
|
|
|
{
|
|
|
- foreach (Students students in stuList.students)
|
|
|
+ if (students.code.Contains(schoolId.GetString()))
|
|
|
{
|
|
|
- if (students.code.Contains(schoolId.GetString()))
|
|
|
- {
|
|
|
- if (!stuIds.Contains(students.id))
|
|
|
- {
|
|
|
- stuIds.Add(students.id);
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
+ if (!stuIds.Contains(students.id))
|
|
|
{
|
|
|
- stuIds.Add(students.id);
|
|
|
+ listStudent.Add((students.id,
|
|
|
+ default,
|
|
|
+ default,
|
|
|
+ students.code,
|
|
|
+ default,
|
|
|
+ default,
|
|
|
+ default,
|
|
|
+ default));
|
|
|
}
|
|
|
}
|
|
|
- if (stuList.tmids.Count > 0)
|
|
|
+ else
|
|
|
{
|
|
|
- foreach (string tid in stuList.tmids)
|
|
|
- {
|
|
|
- stuIds.Add(tid);
|
|
|
- }
|
|
|
+ listStudent.Add((students.id,
|
|
|
+ default,
|
|
|
+ default,
|
|
|
+ students.code,
|
|
|
+ default,
|
|
|
+ default,
|
|
|
+ default,
|
|
|
+ default));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (stuList.tmids.Count > 0)
|
|
|
+ {
|
|
|
+ foreach (string tid in stuList.tmids)
|
|
|
+ {
|
|
|
+ listStudent.Add((tid,
|
|
|
+ default,
|
|
|
+ default,
|
|
|
+ default,
|
|
|
+ default,
|
|
|
+ default,
|
|
|
+ default,
|
|
|
+ default));
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
- /* //ids.Add(id[i].ToJsonString());
|
|
|
- info += ids[i].ToJsonString() + ",";*/
|
|
|
- }
|
|
|
-
|
|
|
+ }
|
|
|
+ var infos = listStudent.Select(o =>
|
|
|
+ new
|
|
|
+ {
|
|
|
+ o.id,
|
|
|
+ o.name,
|
|
|
+ o.pic,
|
|
|
+ o.classId,
|
|
|
+ o.code,
|
|
|
+ o.groupId,
|
|
|
+ o.groupName,
|
|
|
+ o.no
|
|
|
+ });
|
|
|
+ stus.AddRange(infos);
|
|
|
+ /* //ids.Add(id[i].ToJsonString());
|
|
|
+ info += ids[i].ToJsonString() + ",";*/
|
|
|
+
|
|
|
//AzureCosmosQuery cosmosDbQuery = SQLHelper.GetSQL(dict, sql);
|
|
|
/*if (scope.ToString().Equals("school", StringComparison.OrdinalIgnoreCase))
|
|
|
{
|
|
@@ -513,7 +569,7 @@ namespace TEAMModelOS.Controllers
|
|
|
}
|
|
|
}
|
|
|
}*/
|
|
|
- return Ok(new { stuIds });
|
|
|
+ return Ok(new { stus });
|
|
|
/*List<Classroom> sc = await _azureCosmos.FindByDict<Classroom>(request);
|
|
|
return builder.Data(sc).build();*/
|
|
|
}
|