Commit 96ef7e43 by lcx

graphql允许字段为null,添加字典接口

parent 2ed59b4b
......@@ -7,12 +7,12 @@ public class ChartDataType : ObjectGraphType<ChartData>
{
public ChartDataType()
{
Field(x => x.X);
Field(x => x.Y);
Field(x => x.Name);
Field(x => x.Value);
Field(x => x.Total);
Field(x => x.Type);
Field(x => x.X, nullable: true);
Field(x => x.Y, nullable: true);
Field(x => x.Name, nullable: true);
Field(x => x.Value, nullable: true);
Field(x => x.Total, nullable: true);
Field(x => x.Type, nullable: true);
}
}
}
......@@ -59,6 +59,21 @@ public PerformanceQuery(GraphQLService service)
return service.GetReportPerformance(reportId, parameters);
}
);
Field<ListGraphType<ReportPerformanceType>>("dictionary",
arguments: new QueryArguments(
new QueryArgument<IntGraphType>() { Name = QueryParams.reportId },
new QueryArgument<ListGraphType<StringGraphType>>() { Name = QueryParams.category }
),
resolve: context =>
{
int reportId = context.Arguments.ContainsKey(QueryParams.reportId)
? ConvertHelper.To<int>(context.Arguments[QueryParams.reportId])
: 15;
var parameters = GetDynamicParameters(context.Arguments, QueryParams.category);
return service.GetReportPerformance(reportId, parameters);
}
);
}
public static QueryArguments Arguments(params QueryArgument[] args)
......@@ -92,10 +107,7 @@ public DynamicParameters GetDynamicParameters(Dictionary<string, object> argumen
{
if (arguments.ContainsKey(item))
{
if (item == QueryParams.category)
parameters.Add(item.ToLower(), arguments[item]?.ToString().Split(','));
else
parameters.Add(item.ToLower(), arguments[item]);
parameters.Add(item.ToLower(), arguments[item]);
}
}
}
......
......@@ -9,9 +9,9 @@ public class ReportDataType : ObjectGraphType<ReportData>
{
public ReportDataType()
{
Field(x => x.ReportID);
Field(x => x.ChartType);
Field(x => x.Sort);
Field(x => x.ReportID, type: typeof(IdGraphType));
Field(x => x.ChartType, nullable: true);
Field(x => x.Sort, nullable: true);
Field(x => x.Title);
Field(x => x.QueryName);
Field(x => x.QueryArguments);
......@@ -24,8 +24,8 @@ public ReportDataType()
Field(x => x.NTitle);
Field(x => x.NUnit);
Field(x => x.Formula);
Field(x => x.DataType);
Field(x => x.FilterValue);
Field(x => x.DataType, nullable: true);
Field(x => x.FilterValue, nullable: true);
}
}
}
......@@ -8,14 +8,14 @@ public class ReportPerformanceType : ObjectGraphType<ReportTable>
{
public ReportPerformanceType()
{
Field(x => x.AccountingUnit);
Field(x => x.Category);
Field(x => x.ItemName);
Field(x => x.CurrentValue);
Field(x => x.LastIssueValue);
Field(x => x.SamePeriodValue);
Field(x => x.BudgetValue);
Field(x => x.RatioValue);
Field(x => x.AccountingUnit, nullable: true);
Field(x => x.Category, nullable: true);
Field(x => x.ItemName, nullable: true);
Field(x => x.CurrentValue, nullable: true);
Field(x => x.LastIssueValue, nullable: true);
Field(x => x.SamePeriodValue, nullable: true);
Field(x => x.BudgetValue, nullable: true);
Field(x => x.RatioValue, nullable: true);
}
}
}
......@@ -10,8 +10,8 @@ public class ReportData
public ReportData(rep_report report)
{
ReportID = report.ID;
ChartType = report.ChartType ?? 0;
Sort = report.Sort ?? 0;
ChartType = report.ChartType;
Sort = report.Sort;
Title = report.Title;
QueryName = report.QueryName;
QueryArguments = report.QueryArguments;
......@@ -24,8 +24,8 @@ public ReportData(rep_report report)
NTitle = report.NTitle;
NUnit = report.NUnit;
Formula = report.Formula;
DataType = report.DataType ?? 0;
FilterValue = report.FilterValue ?? 0;
DataType = report.DataType;
FilterValue = report.FilterValue;
ChartData = new List<ChartData>();
}
......@@ -34,12 +34,12 @@ public ReportData(rep_report report)
/// <summary>
///
/// </summary>
public int ChartType { get; set; }
public Nullable<int> ChartType { get; set; }
/// <summary>
///
/// </summary>
public int Sort { get; set; }
public Nullable<int> Sort { get; set; }
/// <summary>
/// 报表标题
......@@ -104,12 +104,12 @@ public ReportData(rep_report report)
/// <summary>
/// 1表示需要进行小于百分2的类型进行合并
/// </summary>
public int DataType { get; set; }
public Nullable<int> DataType { get; set; }
/// <summary>
/// 图标value过滤执值
/// </summary>
public decimal FilterValue { get; set; }
public Nullable<decimal> FilterValue { get; set; }
/// <summary>
/// 图表数据
......@@ -146,7 +146,7 @@ public class ChartData
/// <summary>
/// 总量
/// </summary>
public decimal Total { get; set; }
public Nullable<decimal> Total { get; set; }
/// <summary>
/// ChartData 类型标签
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment