|
@@ -219,6 +219,47 @@ namespace TEAMModelBI.Tool
|
|
|
return totals;
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// 单个容器数据统计 double
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="cosmosClient"></param>
|
|
|
+ /// <param name="container"></param>
|
|
|
+ /// <param name="SqlTxt"></param>
|
|
|
+ /// <param name="code"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public static async Task<double> GetSqlValueDoubleCounnt(CosmosClient cosmosClient, string container, string SqlTxt, string code = null)
|
|
|
+ {
|
|
|
+ double totals = 0;
|
|
|
+ await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", container).GetItemQueryIterator<double>(queryText: SqlTxt, requestOptions: string.IsNullOrEmpty(code) ? new QueryRequestOptions() { } : new QueryRequestOptions() { PartitionKey = new PartitionKey(code) }))
|
|
|
+ {
|
|
|
+ totals = item;
|
|
|
+ }
|
|
|
+
|
|
|
+ return totals;
|
|
|
+ }
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 多个容器数据统计 double
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="cosmosClient"></param>
|
|
|
+ /// <param name="container"></param>
|
|
|
+ /// <param name="SqlTxt"></param>
|
|
|
+ /// <param name="code"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public static async Task<double> GetSqlValueDoubleCounnt(CosmosClient cosmosClient, List<string> containers, string SqlTxt, string code = null)
|
|
|
+ {
|
|
|
+ double totals = 0;
|
|
|
+ foreach (var container in containers)
|
|
|
+ {
|
|
|
+ await foreach (var item in cosmosClient.GetContainer("TEAMModelOS", container).GetItemQueryIterator<double>(queryText: SqlTxt, requestOptions: string.IsNullOrEmpty(code) ? new QueryRequestOptions() { } : new QueryRequestOptions() { PartitionKey = new PartitionKey(code) }))
|
|
|
+ {
|
|
|
+ totals += item;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return totals;
|
|
|
+ }
|
|
|
+
|
|
|
/// <summary>
|
|
|
/// 通过SQL 语句返回实体信息
|
|
|
/// </summary>
|