修改(服务端)接口统计BUG
This commit is contained in:
parent
abdab25e6e
commit
18f30c441b
@ -91,7 +91,7 @@ public class AggregationBuilder
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 验证字段有效性
|
/// 验证字段有效性
|
||||||
/// </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>();
|
if (fields == null || fields.Length == 0) return new List<string>();
|
||||||
|
|
||||||
@ -99,7 +99,7 @@ public class AggregationBuilder
|
|||||||
.Where(f => !string.IsNullOrWhiteSpace(f))
|
.Where(f => !string.IsNullOrWhiteSpace(f))
|
||||||
.Select(f => f.Trim())
|
.Select(f => f.Trim())
|
||||||
.Where(f => targetType.GetProperty(
|
.Where(f => targetType.GetProperty(
|
||||||
targetType == typeof(UsagetokenOutput) ?
|
targetType == typeof(T) ?
|
||||||
$"{f}Sum" : f) != null)
|
$"{f}Sum" : f) != null)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -267,7 +267,7 @@ if (@column.ColumnKey == "True"){
|
|||||||
// HAVING(SUM(cost) > 10000) AND(AVG(CAST(response_time AS FLOAT)) < 500)
|
// 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)
|
if (groupFields.Count > 0)
|
||||||
{
|
{
|
||||||
query = query.GroupBy(string.Join(",", groupFields));
|
query = query.GroupBy(string.Join(",", groupFields));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user