|
@@ -11,6 +11,7 @@ using System.Text.Json;
|
|
|
using System.Threading.Tasks;
|
|
|
using TEAMModelBI.Filter;
|
|
|
using TEAMModelBI.Models;
|
|
|
+using TEAMModelBI.Tool;
|
|
|
using TEAMModelBI.Tool.Extension;
|
|
|
using TEAMModelOS.Models;
|
|
|
using TEAMModelOS.SDK;
|
|
@@ -415,6 +416,7 @@ namespace TEAMModelBI.Controllers.BINormal
|
|
|
return Ok(new { state = RespondCode.Ok, teacher });
|
|
|
}
|
|
|
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 通过区域ID查询学校列表 //已对接
|
|
|
/// </summary>
|
|
@@ -424,7 +426,7 @@ namespace TEAMModelBI.Controllers.BINormal
|
|
|
[HttpPost("get-schools")]
|
|
|
public async Task<IActionResult> GetSchools(JsonElement jsonElement)
|
|
|
{
|
|
|
- if (!jsonElement.TryGetProperty("areaId", out JsonElement areaId)) return BadRequest();
|
|
|
+ jsonElement.TryGetProperty("areaId", out JsonElement areaId);
|
|
|
//jsonElement.TryGetProperty("site", out JsonElement site);//分开部署,就不需要,一站多用时,取消注释
|
|
|
|
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
@@ -434,8 +436,13 @@ namespace TEAMModelBI.Controllers.BINormal
|
|
|
|
|
|
List<AreaSchool> areaSchool = new();
|
|
|
|
|
|
- string areaScSql = $"select c.id,c.name,c.picture,c.size,c.areaId,c.scale from c where c.areaId='{areaId}'";
|
|
|
- await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<AreaSchool>(queryText: areaScSql,requestOptions:new QueryRequestOptions() { PartitionKey = new PartitionKey("Base")}))
|
|
|
+ StringBuilder areaScSql = new($"select c.id,c.name,c.picture,c.size,c.areaId,c.scale from c");
|
|
|
+ if (!string.IsNullOrEmpty($"{areaId}"))
|
|
|
+ areaScSql.Append($" where c.areaId='{areaId}'");
|
|
|
+ else
|
|
|
+ areaScSql.Append(" where c.areaId = null or c.areaId = ''");
|
|
|
+
|
|
|
+ await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<AreaSchool>(queryText: areaScSql.ToString(),requestOptions:new QueryRequestOptions() { PartitionKey = new PartitionKey("Base")}))
|
|
|
{
|
|
|
areaSchool.Add(item);
|
|
|
}
|
|
@@ -473,7 +480,7 @@ namespace TEAMModelBI.Controllers.BINormal
|
|
|
[HttpPost("get-assists")]
|
|
|
public async Task<IActionResult> GetAssists(JsonElement jsonElement)
|
|
|
{
|
|
|
- if (!jsonElement.TryGetProperty("areaId", out JsonElement areaId)) return BadRequest();
|
|
|
+ jsonElement.TryGetProperty("areaId", out JsonElement areaId);
|
|
|
//jsonElement.TryGetProperty("site", out JsonElement site);//分开部署,就不需要,一站多用时,取消注释
|
|
|
|
|
|
var cosmosClient = _azureCosmos.GetCosmosClient();
|
|
@@ -491,12 +498,17 @@ namespace TEAMModelBI.Controllers.BINormal
|
|
|
List<string> scIds = new();
|
|
|
HashSet<string> tchIds = new();
|
|
|
|
|
|
- string scIdsSql = $"select value(c.id) from c where c.areaId='{areaId}'";
|
|
|
+ string scIdsSql = null;
|
|
|
+ if (!string.IsNullOrEmpty($"{areaId}"))
|
|
|
+ scIdsSql = $"select value(c.id) from c where c.areaId='{areaId}'";
|
|
|
+ else
|
|
|
+ scIdsSql = "select value(c.id) from c where c.areaId = null or c.areaId = ''";
|
|
|
+ scIds = await CommonFind.GetValueSingle(cosmosClient, "School", scIdsSql, "Base");
|
|
|
|
|
|
- await foreach (var itemId in cosmosClient.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<string>(queryText: scIdsSql, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("Base") }))
|
|
|
- {
|
|
|
- scIds.Add(itemId);
|
|
|
- }
|
|
|
+ //await foreach (var itemId in cosmosClient.GetContainer("TEAMModelOS", "School").GetItemQueryIterator<string>(queryText: scIdsSql, requestOptions: new QueryRequestOptions() { PartitionKey = new PartitionKey("Base") }))
|
|
|
+ //{
|
|
|
+ // scIds.Add(itemId);
|
|
|
+ //}
|
|
|
|
|
|
foreach (var scId in scIds)
|
|
|
{
|