|
@@ -150,6 +150,12 @@ namespace TEAMModelOS.SDK
|
|
//item.from = "SchStuList";
|
|
//item.from = "SchStuList";
|
|
classInfos.Add(item);
|
|
classInfos.Add(item);
|
|
}
|
|
}
|
|
|
|
+ await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<ClassInfo>(queryText: $"select c.id,c.name from c where c.id in ({sql})",
|
|
|
|
+ requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"TchList-{school}") }))
|
|
|
|
+ {
|
|
|
|
+ //item.from = "SchStuList";
|
|
|
|
+ classInfos.Add(item);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
List<StuList> tchLists = new List<StuList>();
|
|
List<StuList> tchLists = new List<StuList>();
|
|
await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<ClassInfo>(queryText: $"select c.id,c.name from c where c.id in ({sql})",
|
|
await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<ClassInfo>(queryText: $"select c.id,c.name from c where c.id in ({sql})",
|
|
@@ -357,60 +363,35 @@ namespace TEAMModelOS.SDK
|
|
classes.Add(ss);
|
|
classes.Add(ss);
|
|
}
|
|
}
|
|
List<TmdInfo> tmdinfos = new List<TmdInfo>();
|
|
List<TmdInfo> tmdinfos = new List<TmdInfo>();
|
|
- List<Students> studentss = new List<Students>();
|
|
|
|
List<string> tmdids = new List<string>();
|
|
List<string> tmdids = new List<string>();
|
|
List<StuInfo> stuInfos = new List<StuInfo>();
|
|
List<StuInfo> stuInfos = new List<StuInfo>();
|
|
if (!classes.IsNotEmpty()) { return (tmdinfos, new List<StuInfo>(), null); }
|
|
if (!classes.IsNotEmpty()) { return (tmdinfos, new List<StuInfo>(), null); }
|
|
List<string> sqlList = new List<string>();
|
|
List<string> sqlList = new List<string>();
|
|
classes.ForEach(x => { sqlList.Add($" '{x}' "); });
|
|
classes.ForEach(x => { sqlList.Add($" '{x}' "); });
|
|
string sql = string.Join(" , ", sqlList);
|
|
string sql = string.Join(" , ", sqlList);
|
|
- List<StuList> schList = new List<StuList>();
|
|
|
|
- List<Student> students = new List<Student>();
|
|
|
|
|
|
+ List<TchList> tchLists = new List<TchList>();
|
|
|
|
+
|
|
if (!string.IsNullOrEmpty(school))
|
|
if (!string.IsNullOrEmpty(school))
|
|
{
|
|
{
|
|
- await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<StuList>(queryText: $"select value(c) from c where c.id in ({sql})",
|
|
|
|
- requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"StuList-{school}") }))
|
|
|
|
|
|
+ await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<TchList>(queryText: $"select value(c) from c where c.id in ({sql})",
|
|
|
|
+ requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"TchList-{school}") }))
|
|
{
|
|
{
|
|
- schList.Add(item);
|
|
|
|
|
|
+ tchLists.Add(item);
|
|
}
|
|
}
|
|
- await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryIterator<Student>(queryText: $"select value(c) from c where c.classId in ({sql})",
|
|
|
|
- requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Base-{school}") }))
|
|
|
|
- {
|
|
|
|
- students.Add(item);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- List<StuList> tchLists = new List<StuList>();
|
|
|
|
- await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<StuList>(queryText: $"select value(c) from c where c.id in ({sql})",
|
|
|
|
- requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"StuList") }))
|
|
|
|
- {
|
|
|
|
- tchLists.Add(item);
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
|
|
- foreach (var x in schList)
|
|
|
|
- {
|
|
|
|
- if (x.students.IsNotEmpty())
|
|
|
|
- {
|
|
|
|
- studentss.AddRange(x.students);
|
|
|
|
- }
|
|
|
|
- if (x.tmids.IsNotEmpty())
|
|
|
|
- {
|
|
|
|
- tmdids.AddRange(x.tmids);
|
|
|
|
- }
|
|
|
|
- classes.Remove(x.id);
|
|
|
|
- }
|
|
|
|
foreach (var x in tchLists)
|
|
foreach (var x in tchLists)
|
|
{
|
|
{
|
|
- if (x.students.IsNotEmpty())
|
|
|
|
- {
|
|
|
|
- studentss.AddRange(x.students);
|
|
|
|
- }
|
|
|
|
- if (x.tmids.IsNotEmpty())
|
|
|
|
|
|
+
|
|
|
|
+ if (x.teachers.IsNotEmpty())
|
|
{
|
|
{
|
|
- tmdids.AddRange(x.tmids);
|
|
|
|
|
|
+ tmdids.AddRange(x.teachers);
|
|
}
|
|
}
|
|
classes.Remove(x.id);
|
|
classes.Remove(x.id);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
if (tmdids.IsNotEmpty())
|
|
if (tmdids.IsNotEmpty())
|
|
{
|
|
{
|
|
List<TmdInfo> infos = new List<TmdInfo>();
|
|
List<TmdInfo> infos = new List<TmdInfo>();
|
|
@@ -419,54 +400,20 @@ namespace TEAMModelOS.SDK
|
|
var insql = string.Join(",", inids);
|
|
var insql = string.Join(",", inids);
|
|
var queryslt = $"SELECT value(c) FROM c where c.id in ({insql})";
|
|
var queryslt = $"SELECT value(c) FROM c where c.id in ({insql})";
|
|
//合并代码/
|
|
//合并代码/
|
|
- await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryIterator<TmdInfo>(queryText: queryslt, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base") }))
|
|
|
|
|
|
+ await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<TmdInfo>(queryText: queryslt, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base") }))
|
|
{
|
|
{
|
|
infos.Add(item);
|
|
infos.Add(item);
|
|
}
|
|
}
|
|
tmdinfos.AddRange(infos);
|
|
tmdinfos.AddRange(infos);
|
|
}
|
|
}
|
|
- if (studentss.IsNotEmpty())
|
|
|
|
- {
|
|
|
|
- List<string> inidstus = new List<string>();
|
|
|
|
- foreach (Students stu in studentss)
|
|
|
|
- {
|
|
|
|
- var querystu = $"SELECT c.id,c.code,c.name,c.picture,c.classId,c.year,c.schoolId FROM c where c.id = '{stu.id}'";
|
|
|
|
- await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryIterator<StuInfo>(queryText: querystu, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"{stu.code}") }))
|
|
|
|
- {
|
|
|
|
- stuInfos.Add(item);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- /*studentss.Select(x => x.id).ToList().ForEach(x => { inidstus.Add($"'{x}'"); });
|
|
|
|
- var insqlstu = string.Join(",", inidstus);
|
|
|
|
- var querystu = $"SELECT c.id,c.code,c.name,c.picture,c.classId,c.year,c.schoolId FROM c where c.id in ({insqlstu})";
|
|
|
|
- await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryIterator<StuInfo>(queryText: querystu, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Base-{school}") }))
|
|
|
|
- {
|
|
|
|
- stuInfos.Add(item);
|
|
|
|
- }*/
|
|
|
|
- }
|
|
|
|
- students.ForEach(x =>
|
|
|
|
- {
|
|
|
|
- if (!stuInfos.Select(y => y.classId).ToList().Contains(x.id))
|
|
|
|
- {
|
|
|
|
- stuInfos.Add(new StuInfo { id = x.id, code = x.code, schoolId = x.schoolId, classId = x.classId, name = x.name, picture = x.picture, year = x.year, groupId = x.groupId, groupName = x.groupName, no = x.no });
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
|
|
+
|
|
|
|
+
|
|
List<ClassListInfo> classInfo = new List<ClassListInfo>();
|
|
List<ClassListInfo> classInfo = new List<ClassListInfo>();
|
|
- schList.ForEach(x => {
|
|
|
|
|
|
+ tchLists.ForEach(x => {
|
|
ClassListInfo classListInfo = new ClassListInfo { id = x.id, name = x.name };
|
|
ClassListInfo classListInfo = new ClassListInfo { id = x.id, name = x.name };
|
|
- if (x.students.IsNotEmpty())
|
|
|
|
- {
|
|
|
|
- x.students.ForEach(y => {
|
|
|
|
- var stuinfo = stuInfos.Where(z => z.id.Equals(y.id)).FirstOrDefault();
|
|
|
|
- if (stuinfo != null)
|
|
|
|
- {
|
|
|
|
- classListInfo.stuInfos.Add(stuinfo);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- if (x.tmids.IsNotEmpty())
|
|
|
|
|
|
+ if (x.teachers.IsNotEmpty())
|
|
{
|
|
{
|
|
- x.tmids.ForEach(y => {
|
|
|
|
|
|
+ x.teachers.ForEach(y => {
|
|
var tmdinfo = tmdinfos.Where(z => z.id.Equals(y)).FirstOrDefault();
|
|
var tmdinfo = tmdinfos.Where(z => z.id.Equals(y)).FirstOrDefault();
|
|
if (tmdinfo != null)
|
|
if (tmdinfo != null)
|
|
{
|
|
{
|
|
@@ -478,19 +425,9 @@ namespace TEAMModelOS.SDK
|
|
});
|
|
});
|
|
tchLists.ForEach(x => {
|
|
tchLists.ForEach(x => {
|
|
ClassListInfo classListInfo = new ClassListInfo { id = x.id, name = x.name };
|
|
ClassListInfo classListInfo = new ClassListInfo { id = x.id, name = x.name };
|
|
- if (x.students.IsNotEmpty())
|
|
|
|
- {
|
|
|
|
- x.students.ForEach(y => {
|
|
|
|
- var stuinfo = stuInfos.Where(z => z.id.Equals(y.id)).FirstOrDefault();
|
|
|
|
- if (stuinfo != null)
|
|
|
|
- {
|
|
|
|
- classListInfo.stuInfos.Add(stuinfo);
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
- if (x.tmids.IsNotEmpty())
|
|
|
|
|
|
+ if (x.teachers.IsNotEmpty())
|
|
{
|
|
{
|
|
- x.tmids.ForEach(y => {
|
|
|
|
|
|
+ x.teachers.ForEach(y => {
|
|
var tmdinfo = tmdinfos.Where(z => z.id.Equals(y)).FirstOrDefault();
|
|
var tmdinfo = tmdinfos.Where(z => z.id.Equals(y)).FirstOrDefault();
|
|
if (tmdinfo != null)
|
|
if (tmdinfo != null)
|
|
{
|
|
{
|
|
@@ -507,7 +444,6 @@ namespace TEAMModelOS.SDK
|
|
classInfos.ForEach(x =>
|
|
classInfos.ForEach(x =>
|
|
{
|
|
{
|
|
ClassListInfo classListInfo = new ClassListInfo { id = x.id, name = x.name };
|
|
ClassListInfo classListInfo = new ClassListInfo { id = x.id, name = x.name };
|
|
- var list = students.Where(y => y.classId.Equals(x.id)).ToList();
|
|
|
|
list.ForEach(z => { classListInfo.stuInfos.Add(new StuInfo { id = z.id, code = z.code, schoolId = z.schoolId, classId = z.classId, name = z.name, picture = z.picture, year = z.year, groupId = z.groupId, groupName = z.groupName, no = z.no }); });
|
|
list.ForEach(z => { classListInfo.stuInfos.Add(new StuInfo { id = z.id, code = z.code, schoolId = z.schoolId, classId = z.classId, name = z.name, picture = z.picture, year = z.year, groupId = z.groupId, groupName = z.groupName, no = z.no }); });
|
|
classInfo.Add(classListInfo);
|
|
classInfo.Add(classListInfo);
|
|
});
|
|
});
|