|
@@ -1827,9 +1827,15 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
[HttpPost("get-schools")]
|
|
|
public async Task<IActionResult> GetSchools (JsonElement jsonElement)
|
|
|
{
|
|
|
+ jsonElement.TryGetProperty("areaId", out JsonElement areaId);
|
|
|
List<ScBriefInfo> scBriefs = new();
|
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
|
- await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS,"School").GetItemQueryIterator<ScBriefInfo>(queryText:"select value(c) from c" ,requestOptions:new QueryRequestOptions() { PartitionKey = new PartitionKey("Base")}))
|
|
|
+
|
|
|
+ StringBuilder sql = new("select c.id,c.name,c.picture,c.areaId,c.size,c.period from c ");
|
|
|
+ if (!string.IsNullOrEmpty($"{areaId}"))
|
|
|
+ sql.Append($" where c.areaId = '{areaId}'");
|
|
|
+
|
|
|
+ await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS,"School").GetItemQueryIterator<ScBriefInfo>(queryText: sql.ToString(), requestOptions:new QueryRequestOptions() { PartitionKey = new PartitionKey("Base")}))
|
|
|
{
|
|
|
scBriefs.Add(item);
|
|
|
}
|