瀏覽代碼

fix postger sql bug.

master
Savorboard 7 年之前
父節點
當前提交
c531fbddd5
共有 1 個檔案被更改,包括 6 行新增6 行删除
  1. +6
    -6
      src/DotNetCore.CAP.PostgreSql/PostgreSqlMonitoringApi.cs

+ 6
- 6
src/DotNetCore.CAP.PostgreSql/PostgreSqlMonitoringApi.cs 查看文件

@@ -61,13 +61,13 @@ select count(""Id"") from ""{0}"".""received"" where ""StatusName"" in (N'Proce
StringComparison.CurrentCultureIgnoreCase))
where += " and \"StatusName\" in (N'Processing',N'Scheduled',N'Enqueued')";
else
where += " and \"StatusName\" = @StatusName";
where += " and Lower(\"StatusName\") = Lower(@StatusName)";
if (!string.IsNullOrEmpty(queryDto.Name))
where += " and \"Name\" = @Name";
where += " and Lower(\"Name\") = Lower(@Name)";
if (!string.IsNullOrEmpty(queryDto.Group))
where += " and \"Group\" = @Group";
where += " and Lower(\"Group\") = Lower(@Group)";
if (!string.IsNullOrEmpty(queryDto.Content))
where += " and \"Content\" like '%@Content%'";
where += " and \"Content\" ILike '%@Content%'";

var sqlQuery =
$"select * from \"{_options.Schema}\".\"{tableName}\" where 1=1 {where} order by \"Added\" desc offset @Offset limit @Limit";
@@ -131,7 +131,7 @@ select count(""Id"") from ""{0}"".""received"" where ""StatusName"" in (N'Proce
{
var sqlQuery = statusName == StatusName.Processing
? $"select count(\"Id\") from \"{_options.Schema}\".\"{tableName}\" where \"StatusName\" in (N'Processing',N'Scheduled',N'Enqueued')"
: $"select count(\"Id\") from \"{_options.Schema}\".\"{tableName}\" where \"StatusName\" = @state";
: $"select count(\"Id\") from \"{_options.Schema}\".\"{tableName}\" where Lower(\"StatusName\") = Lower(@state)";

var count = connection.ExecuteScalar<int>(sqlQuery, new { state = statusName });
return count;
@@ -174,7 +174,7 @@ with aggr as (
where ""StatusName"" = N'Processing'
group by to_char(""Added"", 'yyyy-MM-dd-HH')
)
select ""Key"",""Count"" from aggr where ""Key""=Any(@keys);";
select ""Key"",""Count"" from aggr where ""Key""= Any(@keys);";

var valuesMap = connection.Query(sqlQuery,new { keys = keyMaps.Keys.ToList(), statusName })
.ToList()


Loading…
取消
儲存