Skip to content

Commit fd01274

Browse files
committed
Fix dashboard sql like query bug. #470
1 parent 5150aee commit fd01274

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/DotNetCore.CAP.PostgreSql/IMonitoringApi.PostgreSql.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public IList<MessageDto> Messages(MessageQueryDto queryDto)
8282

8383
if (!string.IsNullOrEmpty(queryDto.Group)) where += " and Lower(\"Group\") = Lower(@Group)";
8484

85-
if (!string.IsNullOrEmpty(queryDto.Content)) where += " and \"Content\" ILike '%@Content%'";
85+
if (!string.IsNullOrEmpty(queryDto.Content)) where += " and \"Content\" ILike concat('%',@Content,'%')";
8686

8787
var sqlQuery =
8888
$"select * from {tableName} where 1=1 {where} order by \"Added\" desc offset @Offset limit @Limit";

src/DotNetCore.CAP.SqlServer/IMonitoringApi.SqlServer.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public IList<MessageDto> Messages(MessageQueryDto queryDto)
7979

8080
if (!string.IsNullOrEmpty(queryDto.Group)) where += " and [group]=@Group";
8181

82-
if (!string.IsNullOrEmpty(queryDto.Content)) where += " and content like '%@Content%'";
82+
if (!string.IsNullOrEmpty(queryDto.Content)) where += " and content like @Content";
8383

8484
var sqlQuery2008 =
8585
$@"select * from
@@ -96,7 +96,7 @@ public IList<MessageDto> Messages(MessageQueryDto queryDto)
9696
queryDto.StatusName,
9797
queryDto.Group,
9898
queryDto.Name,
99-
queryDto.Content,
99+
Content = "%" + queryDto.Content + "%",
100100
Offset = queryDto.CurrentPage * queryDto.PageSize,
101101
Limit = queryDto.PageSize
102102
}).ToList());

0 commit comments

Comments
 (0)