|
@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Http;
|
|
|
using Microsoft.AspNetCore.Mvc;
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
using Microsoft.Extensions.Options;
|
|
|
+using Microsoft.Extensions.Primitives;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.Linq;
|
|
@@ -14,6 +15,7 @@ using TEAMModelOS.Models;
|
|
|
using TEAMModelOS.SDK;
|
|
|
using TEAMModelOS.SDK.Context.Constant;
|
|
|
using TEAMModelOS.SDK.DI;
|
|
|
+using TEAMModelOS.SDK.Extension;
|
|
|
using TEAMModelOS.SDK.Models.Table;
|
|
|
|
|
|
namespace TEAMModelOS.Controllers
|
|
@@ -56,15 +58,16 @@ namespace TEAMModelOS.Controllers
|
|
|
[HttpPost("get-lists")]
|
|
|
public async Task<IActionResult> GetLog(JsonElement jsonElement)
|
|
|
{
|
|
|
+ var (_, _, _, school) = HttpContext.GetAuthTokenInfo();
|
|
|
jsonElement.TryGetProperty("tmdId", out JsonElement tmdId);
|
|
|
jsonElement.TryGetProperty("startDate", out JsonElement startDate);
|
|
|
jsonElement.TryGetProperty("endDate", out JsonElement endDate);
|
|
|
var table = _azureStorage.GetCloudTableClient().GetTableReference("IESOptLog");
|
|
|
|
|
|
- StringBuilder tableSql = new();
|
|
|
+ StringBuilder tableSql = new($"school eq '{school}'");
|
|
|
|
|
|
if (!string.IsNullOrEmpty($"{tmdId}"))
|
|
|
- tableSql.Append($" tmdId eq {tmdId} ");
|
|
|
+ tableSql.Append(!string.IsNullOrEmpty(tableSql.ToString()) ? $" tmdId eq {tmdId} " : $"tmdId eq {tmdId} ");
|
|
|
if (!string.IsNullOrEmpty($"{startDate}"))
|
|
|
tableSql.Append(!string.IsNullOrEmpty(tableSql.ToString()) ? $" and time ge {startDate}L " : $"time ge {startDate}L ");
|
|
|
if (!string.IsNullOrEmpty($"{endDate}"))
|