|
@@ -48,17 +48,18 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
try
|
|
|
{
|
|
|
jsonElement.TryGetProperty("areaId", out JsonElement _areaId);
|
|
|
- jsonElement.TryGetProperty("isManyArea", out JsonElement isManyArea);
|
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
|
List<JoinAreaSchool> joinAreaSchools = new List<JoinAreaSchool>();
|
|
|
- string slqtxt = $"SELECT c.id,c.name,c.schoolCode,c.province,c.city,c.dist,c.picture,c.period FROM c WHERE c.areaId='{_areaId}'";
|
|
|
+ string sqltxt = $"SELECT c.id,c.name,c.schoolCode,c.province,c.city,c.dist,c.picture,c.period FROM c WHERE c.areaId='{_areaId}'";
|
|
|
|
|
|
- if (!string.IsNullOrEmpty($"{isManyArea}"))
|
|
|
+ if (!string.IsNullOrEmpty($"{_areaId}"))
|
|
|
{
|
|
|
- slqtxt = $"SELECT c.id,c.name,c.schoolCode,c.province,c.city,c.dist,c.picture,c.period FROM c join m in c.manyAreas where m.areaId='{_areaId}' or c.areaId='{_areaId}'";
|
|
|
+ sqltxt = $"SELECT c.id,c.name,c.schoolCode,c.province,c.city,c.dist,c.picture,c.period,c.manyAreas FROM c WHERE c.areaId ='{_areaId}' and ARRAY_CONTAINS(c.manyAreas,'{_areaId}',true) or ARRAY_LENGTH(c.manyAreas) = 0 ";
|
|
|
+
|
|
|
+ //sqltxt = $"SELECT c.id,c.name,c.schoolCode,c.province,c.city,c.dist,c.picture,c.period FROM c join m in c.manyAreas where m.areaId='{_areaId}' or c.areaId='{_areaId}'";
|
|
|
}
|
|
|
|
|
|
- await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryStreamIterator(queryText: slqtxt,requestOptions:new QueryRequestOptions() { PartitionKey = new PartitionKey("Base")}))
|
|
|
+ await foreach (var item in cosmosClient.GetContainer(Constant.TEAMModelOS, "School").GetItemQueryStreamIterator(queryText: sqltxt, requestOptions:new QueryRequestOptions() { PartitionKey = new PartitionKey("Base")}))
|
|
|
{
|
|
|
using var json = await JsonDocument.ParseAsync(item.ContentStream);
|
|
|
if (json.RootElement.TryGetProperty("_count", out JsonElement count) && count.GetUInt16() > 0)
|
|
@@ -117,7 +118,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
|
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
|
School tempSchool = await cosmosClient.GetContainer(Constant.TEAMModelOS, "School").ReadItemAsync<School>($"{schoolId}", new PartitionKey("Base"));
|
|
|
- if (string.IsNullOrEmpty($"{isDefault}"))
|
|
|
+ if (bool.Parse($"{isDefault}") == true)
|
|
|
{
|
|
|
tempSchool.areaId = null;
|
|
|
tempSchool.standard = null;
|