Browse Source

update 分支。

CrazyIter_Bin 3 years ago
parent
commit
c26123af51
1 changed files with 6 additions and 2 deletions
  1. 6 2
      TEAMModelOS/Controllers/XTest/FixDataController.cs

+ 6 - 2
TEAMModelOS/Controllers/XTest/FixDataController.cs

@@ -2400,16 +2400,20 @@ namespace TEAMModelOS.Controllers
         public async Task<IActionResult> UnUploadAbilitysub(JsonElement json)
         {
             try {
+                List<string> schools = json.Deserialize<List<string>>();
+                if (!schools.Any()) {
+                    return BadRequest();
+                }
                 var client = _azureCosmos.GetCosmosClient();
                 //金牛直属。
-                string sql = "SELECT  distinct  c.id,s.schoolId as code , c.name    FROM c  join s in  c.schools where s.areaId='f35e0031-a53f-45e5-b307-1cd39446a2cf' and array_length(c.binds)>0 ";
+                string sql = $"SELECT  distinct  c.id,s.schoolId as code , c.name    FROM c  join s in  c.schools where s.areaId='f35e0031-a53f-45e5-b307-1cd39446a2cf'" +
+                    $" and array_length(c.binds)>0  and s.schoolId in ({string.Join(",", schools.Select(s => $"'{s}'"))})";
                 List<IdNameCode> tmdidSchooCode = new List<IdNameCode>();
                 await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Teacher).GetItemQueryIterator<IdNameCode>(queryText: sql,
                     requestOptions: new QueryRequestOptions { PartitionKey = new PartitionKey("Base") }))
                 {
                     tmdidSchooCode.Add(item);
                 }
-
                 List<Ability> abilities = new List<Ability>();
                 string abilitysql = "select value c from  c ";
                 await foreach (var item in _azureCosmos.GetCosmosClient().GetContainer(Constant.TEAMModelOS, Constant.Normal).GetItemQueryIterator<Ability>(queryText: abilitysql,