修改(服务端)接口统计BUG

This commit is contained in:
aq982 2025-02-27 10:04:16 +08:00
parent abdab25e6e
commit 18f30c441b
2 changed files with 3 additions and 3 deletions

View File

@ -91,7 +91,7 @@ public class AggregationBuilder
/// <summary>
/// 验证字段有效性
/// </summary>
public static List<string> ValidateFields(string[] fields, Type targetType)
public static List<string> ValidateFields<T>(string[] fields, Type targetType)
{
if (fields == null || fields.Length == 0) return new List<string>();
@ -99,7 +99,7 @@ public class AggregationBuilder
.Where(f => !string.IsNullOrWhiteSpace(f))
.Select(f => f.Trim())
.Where(f => targetType.GetProperty(
targetType == typeof(UsagetokenOutput) ?
targetType == typeof(T) ?
$"{f}Sum" : f) != null)
.ToList();
}

View File

@ -267,7 +267,7 @@ if (@column.ColumnKey == "True"){
// HAVING(SUM(cost) > 10000) AND(AVG(CAST(response_time AS FLOAT)) < 500)
// 处理分组字段
var groupFields = AggregationBuilder.ValidateFields(input.GroupBy, typeof(@(@Model.ClassName)Output));
var groupFields = AggregationBuilder.ValidateFields<@(@Model.ClassName)Output>(input.GroupBy, typeof(@(@Model.ClassName)Output));
if (groupFields.Count > 0)
{
query = query.GroupBy(string.Join(",", groupFields));