|
@@ -47,6 +47,7 @@ namespace TEAMModelBI.Controllers.OperateRecord
|
|
jsonElement.TryGetProperty("startDate", out JsonElement startDate);
|
|
jsonElement.TryGetProperty("startDate", out JsonElement startDate);
|
|
jsonElement.TryGetProperty("endDate", out JsonElement endDate);
|
|
jsonElement.TryGetProperty("endDate", out JsonElement endDate);
|
|
jsonElement.TryGetProperty("platform", out JsonElement platform);
|
|
jsonElement.TryGetProperty("platform", out JsonElement platform);
|
|
|
|
+ jsonElement.TryGetProperty("reorder", out JsonElement orderby);
|
|
|
|
|
|
List<BIOptLog> operateLogs = new();
|
|
List<BIOptLog> operateLogs = new();
|
|
StringBuilder tableSql = new StringBuilder();
|
|
StringBuilder tableSql = new StringBuilder();
|
|
@@ -59,10 +60,24 @@ namespace TEAMModelBI.Controllers.OperateRecord
|
|
tableSql.Append(!string.IsNullOrEmpty(tableSql.ToString()) ? $" and time le {endDate}L " : $" time le {endDate}L ");
|
|
tableSql.Append(!string.IsNullOrEmpty(tableSql.ToString()) ? $" and time le {endDate}L " : $" time le {endDate}L ");
|
|
if (!string.IsNullOrEmpty($"{platform}"))
|
|
if (!string.IsNullOrEmpty($"{platform}"))
|
|
tableSql.Append(!string.IsNullOrEmpty(tableSql.ToString()) ? $" and platform eq '{platform}' " : $" platform eq '{platform}' ");
|
|
tableSql.Append(!string.IsNullOrEmpty(tableSql.ToString()) ? $" and platform eq '{platform}' " : $" platform eq '{platform}' ");
|
|
-
|
|
|
|
|
|
+
|
|
var table = _azureStorage.GetCloudTableClient().GetTableReference("BIOptLog");
|
|
var table = _azureStorage.GetCloudTableClient().GetTableReference("BIOptLog");
|
|
|
|
+
|
|
|
|
+ //lambda 表达式排序
|
|
operateLogs = await table.QueryWhereString<BIOptLog>(tableSql.ToString());
|
|
operateLogs = await table.QueryWhereString<BIOptLog>(tableSql.ToString());
|
|
- return Ok(new { state = 200, operateLogs });
|
|
|
|
|
|
+ switch (orderby.GetString())
|
|
|
|
+ {
|
|
|
|
+ case "asc":
|
|
|
|
+ //lambda 排序 升序
|
|
|
|
+ operateLogs.Sort((x, y) => x.time.CompareTo(y.time));
|
|
|
|
+ return Ok(new { state = 200, operateLogs });
|
|
|
|
+ case "desc":
|
|
|
|
+ //lambda 排序 降序
|
|
|
|
+ operateLogs.Sort((x, y) => y.time.CompareTo(x.time));
|
|
|
|
+ return Ok(new { state = 200, operateLogs });
|
|
|
|
+ default:
|
|
|
|
+ return Ok(new { state = 200, operateLogs });
|
|
|
|
+ }
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
{
|
|
{
|