Li 2 роки тому
батько
коміт
937d991b40

+ 10 - 4
TEAMModelBI/Controllers/BISchool/BatchSchoolController.cs

@@ -301,13 +301,14 @@ namespace TEAMModelBI.Controllers.BISchool
             try
             {
                 jsonElement.TryGetProperty("tmdId", out JsonElement tmdId);
-                jsonElement.TryGetProperty("schoolCode", out JsonElement _schoolCode);
+                jsonElement.TryGetProperty("scId", out JsonElement scId);
+                jsonElement.TryGetProperty("name", out JsonElement name);
                 jsonElement.TryGetProperty("site", out JsonElement site);
                 var cosmosClient = _azureCosmos.GetCosmosClient();
                 if ($"{site}".Equals(BIConst.Global))
                     cosmosClient = _azureCosmos.GetCosmosClient(name: BIConst.Global);
 
-                int? pageSize = null;      //默认不指定返回大小        
+                int? pageSize = 10;      //默认不指定返回大小        
                 string continuationToken = string.Empty;     //返给前端分页token           
                 string pageToken = default;//接受前端的分页Tolen
                 bool iscontinuation = false;//是否需要进行分页查询,默认不分页
@@ -349,9 +350,14 @@ namespace TEAMModelBI.Controllers.BISchool
                 }
                 else
                 {
-                    if (!string.IsNullOrEmpty($"{_schoolCode}"))
+                    if (!string.IsNullOrEmpty($"{scId}") && string.IsNullOrEmpty($"{name}"))
                     {
-                        stringBuilder.Append($" where c.id='{_schoolCode}'");
+                        stringBuilder.Append($" where c.id='{scId}'");
+                    }
+
+                    if (string.IsNullOrEmpty($"{scId}") && !string.IsNullOrEmpty($"{name}"))
+                    {
+                        stringBuilder.Append($" where Contains(c.name,'{name}')");
                     }
 
                     await foreach (var itemSchool in cosmosClient.GetContainer("TEAMModelOS", "School").GetItemQueryStreamIterator(queryText: stringBuilder.ToString(), continuationToken: pageToken, requestOptions: new QueryRequestOptions() { MaxItemCount = pageSize, PartitionKey = new PartitionKey("Base") }))