|
@@ -216,7 +216,7 @@ namespace TEAMModelOS.Controllers
|
|
|
json.TryGetProperty("schoolId", out JsonElement schoolId);
|
|
|
if (!json.TryGetProperty("opt", out JsonElement opt)) { return BadRequest(); }
|
|
|
json.TryGetProperty("periodId", out JsonElement periodId);
|
|
|
- List<GroupListDto> groupLists = new List<GroupListDto>();
|
|
|
+ List<GroupListGrp> groupLists = new List<GroupListGrp>();
|
|
|
switch (true)
|
|
|
{
|
|
|
//我管理的
|
|
@@ -230,8 +230,15 @@ namespace TEAMModelOS.Controllers
|
|
|
await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<ClassInfo>(queryText: sql.ToString(),
|
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"Class-{schoolId}") }))
|
|
|
{
|
|
|
+ HashSet<string> groupNames = new HashSet<string>();
|
|
|
+ string gpsql = $"SELECT distinct c.groupId,c.groupName FROM c where c.classId='{item.id}'and c.groupName <>null";
|
|
|
+ await foreach (var gp in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryIterator<Student>(queryText: gpsql,
|
|
|
+ requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Base-{schoolId}") }))
|
|
|
+ {
|
|
|
+ groupNames.Add(gp.groupName);
|
|
|
+ }
|
|
|
///行政班(学生搜寻classId动态返回)class
|
|
|
- GroupListDto group = new GroupListDto
|
|
|
+ GroupListGrp group = new GroupListGrp
|
|
|
{
|
|
|
id = item.id,
|
|
|
code = $"GroupList-{schoolId}",
|
|
@@ -240,11 +247,12 @@ namespace TEAMModelOS.Controllers
|
|
|
scope = "school",
|
|
|
school = $"{schoolId}",
|
|
|
type = "class",
|
|
|
- year = item.year
|
|
|
+ year = item.year,
|
|
|
+ groupName= groupNames
|
|
|
};
|
|
|
groupLists.Add(group);
|
|
|
}
|
|
|
- string sqls = $"SELECT distinct {SummarySql} FROM c ";
|
|
|
+ string sqls = $"SELECT distinct value(c) FROM c ";
|
|
|
//教学班
|
|
|
sql = new StringBuilder($"{sqls} where c.type='teach'");
|
|
|
if (!string.IsNullOrEmpty($"{periodId}"))
|
|
@@ -252,16 +260,25 @@ namespace TEAMModelOS.Controllers
|
|
|
sql.Append($" and c.periodId='{periodId}'");
|
|
|
}
|
|
|
await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").
|
|
|
- GetItemQueryIterator<GroupListDto>(queryText: sql.ToString(), requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"GroupList-{schoolId}") }))
|
|
|
+ GetItemQueryIterator<GroupList>(queryText: sql.ToString(), requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"GroupList-{schoolId}") }))
|
|
|
{
|
|
|
- groupLists.Add(item);
|
|
|
+ HashSet<string> groupName = item.members.Where(x => !string.IsNullOrEmpty(x.groupName)).Select(y=>y.groupName).ToHashSet();
|
|
|
+ groupLists.Add(new GroupListGrp(item, groupName));
|
|
|
}
|
|
|
//教研组
|
|
|
sql = new StringBuilder($"{sqls} where c.type='research'");
|
|
|
await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").
|
|
|
- GetItemQueryIterator<GroupListDto>(queryText: sql.ToString(), requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"GroupList-{schoolId}") }))
|
|
|
+ GetItemQueryIterator<GroupList>(queryText: sql.ToString(), requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"GroupList-{schoolId}") }))
|
|
|
+ {
|
|
|
+ HashSet<string> groupName = item.members.Where(x => !string.IsNullOrEmpty(x.groupName)).Select(y => y.groupName).ToHashSet();
|
|
|
+ groupLists.Add(new GroupListGrp(item, groupName));
|
|
|
+ }//教研组
|
|
|
+ sql = new StringBuilder($"{sqls} where c.type='yxtrain'");
|
|
|
+ await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").
|
|
|
+ GetItemQueryIterator<GroupList>(queryText: sql.ToString(), requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey($"GroupList-{schoolId}") }))
|
|
|
{
|
|
|
- groupLists.Add(item);
|
|
|
+ HashSet<string> groupName = item.members.Where(x => !string.IsNullOrEmpty(x.groupName)).Select(y => y.groupName).ToHashSet();
|
|
|
+ groupLists.Add(new GroupListGrp(item, groupName));
|
|
|
}
|
|
|
return Ok(new { groupLists });
|
|
|
case bool when $"{opt}".Equals("teach", StringComparison.OrdinalIgnoreCase):
|
|
@@ -298,7 +315,14 @@ namespace TEAMModelOS.Controllers
|
|
|
await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<ClassInfo>(queryText: $"select c.id,c.name ,c.periodId ,c.year from c where c.id in ({insql})",
|
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Class-{schoolId}") }))
|
|
|
{
|
|
|
- GroupListDto group = new GroupListDto
|
|
|
+ HashSet<string> groupNames = new HashSet<string>();
|
|
|
+ string gpsql = $"SELECT distinct c.groupId,c.groupName FROM c where c.classId='{item.id}'and c.groupName <>null";
|
|
|
+ await foreach (var gp in client.GetContainer(Constant.TEAMModelOS, "Student").GetItemQueryIterator<Student>(queryText: gpsql,
|
|
|
+ requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"Base-{schoolId}") }))
|
|
|
+ {
|
|
|
+ groupNames.Add(gp.groupName);
|
|
|
+ }
|
|
|
+ GroupListGrp group = new GroupListGrp
|
|
|
{
|
|
|
id = item.id,
|
|
|
code = $"GroupList-{schoolId}",
|
|
@@ -307,9 +331,12 @@ namespace TEAMModelOS.Controllers
|
|
|
scope = "school",
|
|
|
school = $"{schoolId}",
|
|
|
type = "class",
|
|
|
- year = item.year
|
|
|
+ year = item.year,
|
|
|
+ groupName = groupNames
|
|
|
};
|
|
|
- groupLists.Add(group);
|
|
|
+
|
|
|
+
|
|
|
+ groupLists.Add(group);
|
|
|
}
|
|
|
}
|
|
|
if (schedule.IsNotEmpty())
|
|
@@ -318,10 +345,12 @@ namespace TEAMModelOS.Controllers
|
|
|
if (privateList.Count() > 0)
|
|
|
{
|
|
|
string insql = string.Join(",", privateList.Select(x => $"'{x}'"));
|
|
|
- await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<GroupListDto>(queryText: $"select distinct {SummarySql} from c where c.id in ({insql})",
|
|
|
+ await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "Teacher").GetItemQueryIterator<GroupList>(queryText: $"select distinct {SummarySql} from c where c.id in ({insql})",
|
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"GroupList") }))
|
|
|
{
|
|
|
- groupLists.Add(item);
|
|
|
+ HashSet<string> groupName = item.members.Where(x => !string.IsNullOrEmpty(x.groupName)).Select(y => y.groupName).ToHashSet();
|
|
|
+ groupLists.Add(new GroupListGrp(item, groupName));
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
var schoolList = schedule.Where(x => x.scope.Equals("school")).Select(x => x.schedule.stulist).Distinct();
|
|
@@ -329,20 +358,21 @@ namespace TEAMModelOS.Controllers
|
|
|
{
|
|
|
List<GroupListDto> groups = new List<GroupListDto>();
|
|
|
string insql = string.Join(",", schoolList.Select(x => $"'{x}'"));
|
|
|
- await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<GroupListDto>(queryText: $"select distinct {SummarySql} from c where c.id in ({insql})",
|
|
|
+ await foreach (var item in client.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryIterator<GroupList>(queryText: $"select distinct {SummarySql} from c where c.id in ({insql})",
|
|
|
requestOptions: new QueryRequestOptions() { PartitionKey = new Azure.Cosmos.PartitionKey($"GroupList-{schoolId}") }))
|
|
|
{
|
|
|
- groupLists.Add(item);
|
|
|
+ HashSet<string> groupName = item.members.Where(x => !string.IsNullOrEmpty(x.groupName)).Select(y => y.groupName).ToHashSet();
|
|
|
+ groupLists.Add(new GroupListGrp(item, groupName));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
List<CourseGroupList> courseGroups = new List<CourseGroupList>();
|
|
|
teachCourses.GroupBy(y => (y.id, y.name, y.scope, y.period.name, y.period.id, y.subject.name, y.subject.id)).ToList().ForEach(x => {
|
|
|
- List<GroupListDto> classIds = groupLists.Where(n => x.Where(m => !string.IsNullOrEmpty(m.schedule.classId)).Select(b=>b.schedule.classId).Contains(n.id)).ToList();
|
|
|
- List<GroupListDto> stulists = groupLists.Where(n => x.Where(m => !string.IsNullOrEmpty(m.schedule.stulist)).Select(b => b.schedule.stulist).Contains(n.id)).ToList();
|
|
|
+ List<GroupListGrp> classIds = groupLists.Where(n => x.Where(m => !string.IsNullOrEmpty(m.schedule.classId)).Select(b=>b.schedule.classId).Contains(n.id)).ToList();
|
|
|
+ List<GroupListGrp> stulists = groupLists.Where(n => x.Where(m => !string.IsNullOrEmpty(m.schedule.stulist)).Select(b => b.schedule.stulist).Contains(n.id)).ToList();
|
|
|
if (classIds == null)
|
|
|
{
|
|
|
- classIds = new List<GroupListDto>();
|
|
|
+ classIds = new List<GroupListGrp>();
|
|
|
}
|
|
|
if (stulists != null)
|
|
|
{
|