|
@@ -36,6 +36,7 @@ using DocumentFormat.OpenXml.Spreadsheet;
|
|
|
using DocumentFormat.OpenXml.Wordprocessing;
|
|
|
using DocumentFormat.OpenXml.Bibliography;
|
|
|
using HTEXLib;
|
|
|
+using TEAMModelOS.SDK.Models.Service.BI;
|
|
|
|
|
|
namespace TEAMModelBI.Controllers.BISchool
|
|
|
{
|
|
@@ -528,7 +529,7 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
List<AssistSchool> schoolAssists = new(); //返回学校列表集合
|
|
|
List<string> schoolIds = new();
|
|
|
StringBuilder stringBuilder = new("select c.id,c.code,c.schoolCode,c.name,c.region,c.province,c.city,c.dist,c.size,c.address,c.picture,c.type,c.scale,c.areaId,c.standard from c ");
|
|
|
- scCnt = await CommonFind.GetSqlValueCount(cosmosClient, "School", "select value(count(c.id)) from c", "Base");
|
|
|
+ StringBuilder scCntSql = new($"select value(count(c.id)) from c");
|
|
|
if (jsonElement.TryGetProperty("pageSize", out JsonElement jsonPageSize))
|
|
|
{
|
|
|
if (!jsonPageSize.ValueKind.Equals(JsonValueKind.Undefined) && !jsonPageSize.ValueKind.Equals(JsonValueKind.Null) && jsonPageSize.TryGetInt32(out int tempPageSize))
|
|
@@ -548,10 +549,13 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
if (!string.IsNullOrEmpty($"{tmdId}"))
|
|
|
{
|
|
|
schoolIds = await CommonFind.FindSchoolIds(cosmosClient, $"{tmdId}");
|
|
|
+ string scsSql = BICommonWay.ManyScSql("c.school", schoolIds);
|
|
|
+ scCntSql.Append(scsSql);
|
|
|
}
|
|
|
|
|
|
if (schoolIds.Count > 0)
|
|
|
{
|
|
|
+ scCnt = await CommonFind.GetSqlValueCount(cosmosClient, "School", scCntSql.ToString(), "Base");
|
|
|
foreach (var id in schoolIds)
|
|
|
{
|
|
|
StringBuilder sqlTxt = new($"select c.id,c.code,c.schoolCode,c.name,c.region,c.province,c.city,c.dist,c.size,c.address,c.picture,c.type,c.scale,c.areaId,c.standard from c where c.id='{id}'");
|
|
@@ -570,21 +574,38 @@ namespace TEAMModelBI.Controllers.BISchool
|
|
|
else
|
|
|
{
|
|
|
if (!string.IsNullOrEmpty($"{scId}") && string.IsNullOrEmpty($"{name}"))
|
|
|
+ {
|
|
|
stringBuilder.Append($" where c.id='{scId}'");
|
|
|
+ scCntSql.Append($" where c.id='{scId}'");
|
|
|
+ }
|
|
|
if (string.IsNullOrEmpty($"{scId}") && !string.IsNullOrEmpty($"{name}"))
|
|
|
+ {
|
|
|
stringBuilder.Append($" where Contains(c.name,'{name}')");
|
|
|
+ scCntSql.Append($" where Contains(c.name,'{name}')");
|
|
|
+ }
|
|
|
if (!string.IsNullOrEmpty($"{province}") && string.IsNullOrEmpty($"{city}") && string.IsNullOrEmpty($"{dist}"))
|
|
|
+ {
|
|
|
stringBuilder.Append($" where Contains(c.province,'{province}')");
|
|
|
- if (!string.IsNullOrEmpty($"{city}") && !string.IsNullOrEmpty($"{city}") && string.IsNullOrEmpty($"{dist}"))
|
|
|
+ scCntSql.Append($" where Contains(c.province,'{province}')");
|
|
|
+ }
|
|
|
+ if (!string.IsNullOrEmpty($"{city}") && !string.IsNullOrEmpty($"{city}") && string.IsNullOrEmpty($"{dist}"))
|
|
|
+ {
|
|
|
stringBuilder.Append($" where Contains(c.province,'{province}') and Contains(c.city,'{city}')");
|
|
|
+ scCntSql.Append($" where Contains(c.province,'{province}') and Contains(c.city,'{city}')");
|
|
|
+ }
|
|
|
if (!string.IsNullOrEmpty($"{dist}") && !string.IsNullOrEmpty($"{city}") && !string.IsNullOrEmpty($"{dist}"))
|
|
|
+ {
|
|
|
stringBuilder.Append($" where Contains(c.province,'{province}') and Contains(c.city,'{city}') and Contains(c.dist,'{dist}')");
|
|
|
+ scCntSql.Append($" where Contains(c.province,'{province}') and Contains(c.city,'{city}') and Contains(c.dist,'{dist}')");
|
|
|
+ }
|
|
|
|
|
|
if ($"{order}".Equals("desc"))
|
|
|
{
|
|
|
stringBuilder.Append(" order by c.createTime desc");
|
|
|
}
|
|
|
|
|
|
+ scCnt = await CommonFind.GetSqlValueCount(cosmosClient, "School", scCntSql.ToString(), "Base");
|
|
|
+
|
|
|
await foreach (var itemSchool in cosmosClient.GetContainer("TEAMModelOS", "School").GetItemQueryStreamIterator(queryText: stringBuilder.ToString(), continuationToken: pageToken, requestOptions: new QueryRequestOptions() { MaxItemCount = pageSize, PartitionKey = new PartitionKey("Base") }))
|
|
|
{
|
|
|
using var json = await JsonDocument.ParseAsync(itemSchool.ContentStream);
|