|
@@ -441,23 +441,23 @@ namespace TEAMModelOS.Function
|
|
{
|
|
{
|
|
var ids = graduate_classes.Where(x => !string.IsNullOrWhiteSpace(x.id)).Select(x => $"'{x.id}'");
|
|
var ids = graduate_classes.Where(x => !string.IsNullOrWhiteSpace(x.id)).Select(x => $"'{x.id}'");
|
|
List<Student> students = new List<Student>();
|
|
List<Student> students = new List<Student>();
|
|
- string sql = $"select value c from c where (c.graduate = 0 or IS_DEFINED(c.graduate) = false) and c.classId in ({string.Join(",", ids)})";
|
|
|
|
|
|
+ string sql = $"select value c from c where c.classId in ({string.Join(",", ids)})";
|
|
await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Student)
|
|
await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Student)
|
|
.GetItemQueryIteratorSql<Student>(queryText: sql, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"Base-{schoolId}") }))
|
|
.GetItemQueryIteratorSql<Student>(queryText: sql, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"Base-{schoolId}") }))
|
|
{
|
|
{
|
|
item.graduate = 1;
|
|
item.graduate = 1;
|
|
students.Add(item);
|
|
students.Add(item);
|
|
}
|
|
}
|
|
- //foreach (var item in students)
|
|
|
|
- //{
|
|
|
|
- // item.graduate = 1;
|
|
|
|
- // await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Student).ReplaceItemAsync<Student>(item, item.id, new PartitionKey($"Base-{schoolId}"));
|
|
|
|
- //}
|
|
|
|
- //foreach (var item in graduate_classes)
|
|
|
|
- //{
|
|
|
|
- // item.graduate = 1;
|
|
|
|
- // await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReplaceItemAsync<Class>(item, item.id, new PartitionKey($"Class-{schoolId}"));
|
|
|
|
- //}
|
|
|
|
|
|
+ foreach (var item in students)
|
|
|
|
+ {
|
|
|
|
+ item.graduate = 1;
|
|
|
|
+ await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Student).ReplaceItemAsync<Student>(item, item.id, new PartitionKey($"Base-{schoolId}"));
|
|
|
|
+ }
|
|
|
|
+ foreach (var item in graduate_classes)
|
|
|
|
+ {
|
|
|
|
+ item.graduate = 1;
|
|
|
|
+ await _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.School).ReplaceItemAsync<Class>(item, item.id, new PartitionKey($"Class-{schoolId}"));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//未毕业的
|
|
//未毕业的
|
|
@@ -468,7 +468,7 @@ namespace TEAMModelOS.Function
|
|
{
|
|
{
|
|
var ids = cancel_graduate_classes.Where(x => !string.IsNullOrWhiteSpace(x.id)).Select(x => $"'{x.id}'");
|
|
var ids = cancel_graduate_classes.Where(x => !string.IsNullOrWhiteSpace(x.id)).Select(x => $"'{x.id}'");
|
|
List<Student> students = new List<Student>();
|
|
List<Student> students = new List<Student>();
|
|
- string sql = $"select value c from c where c.graduate =1 and c.classId in ({string.Join(",", ids)})";
|
|
|
|
|
|
+ string sql = $"select value c from c where c.classId in ({string.Join(",", ids)})";
|
|
await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Student)
|
|
await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Student)
|
|
.GetItemQueryIteratorSql<Student>(queryText: sql, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"Base-{schoolId}") }))
|
|
.GetItemQueryIteratorSql<Student>(queryText: sql, requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey($"Base-{schoolId}") }))
|
|
{
|
|
{
|