refactor: 更新代码

This commit is contained in:
Argo-Lenovo 2022-06-02 10:53:08 +08:00
parent 9a02d45e27
commit 5d4de2c766
1 changed files with 1 additions and 1 deletions

View File

@ -39,7 +39,6 @@ class TraceService : ITrace
public (IEnumerable<Trace> Items, int ItemsCount) GetAll(string? searchText, TraceFilter filter, int pageIndex, int pageItems, List<string> sortList)
{
var sql = new Sql();
using var db = DBManager.Create();
if (!string.IsNullOrEmpty(searchText))
{
sql.Where("UserName Like @0 or Ip Like @0 or RequestUrl Like @0", $"%{searchText}%");
@ -71,6 +70,7 @@ class TraceService : ITrace
sql.OrderBy("Logtime desc");
}
using var db = DBManager.Create();
var data = db.Page<Trace>(pageIndex, pageItems, sql);
return (data.Items, Convert.ToInt32(data.TotalItems));
}