|
|
|
@ -39,15 +39,25 @@ public class SysOpLogService : ISysOpLogService, IDynamicApiController, ITransie
|
|
|
|
|
query.InnerJoin<SysLogOpBuss>((o, b) => o.Id == b.LogId)
|
|
|
|
|
.Where((o, b) => b.BusinessId == input.BusinessId);
|
|
|
|
|
}
|
|
|
|
|
var result = await query.Where(o => o.Success == input.Success)
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(input.Url))
|
|
|
|
|
{
|
|
|
|
|
input.Url = input.Url.Trim();
|
|
|
|
|
if (!input.Url.StartsWith('/'))
|
|
|
|
|
{
|
|
|
|
|
input.Url = $"/{input.Url}";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var result = await query.Where(o => o.Id > 0) // 如果没有Id > 0这个条件,SELECT Count(*) FROM `sys_log_op` 会执行很长时间,最后报错
|
|
|
|
|
.WhereIF(input.Success != null, o => o.Success == input.Success)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.Name), o => o.Name.Contains(input.Name.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.Ip), o => o.Ip == input.Ip.Trim())
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.Url), o => o.Url == input.Url.Trim())
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.Url), o => o.Url == input.Url)
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SearchBeginTime), o => o.OpTime >= DateTime.Parse(input.SearchBeginTime.Trim()))
|
|
|
|
|
.WhereIF(!string.IsNullOrWhiteSpace(input.SearchEndTime), o => o.OpTime <= DateTime.Parse(input.SearchEndTime.Trim()))
|
|
|
|
|
.OrderByIF(input.SortField == "opTime", o => o.Id, input.DescSort ? OrderByType.Desc : OrderByType.Asc)
|
|
|
|
|
.OrderByIF(input.SortField == "ip", o => o.Ip, input.DescSort ? OrderByType.Desc : OrderByType.Asc)
|
|
|
|
|
.OrderByIF(input.SortField == "name", o => o.Name, input.DescSort ? OrderByType.Desc : OrderByType.Asc)
|
|
|
|
|
.OrderByIF(string.IsNullOrWhiteSpace(input.SortField) || string.Equals(input.SortField, "opTime", StringComparison.OrdinalIgnoreCase), o => o.Id, input.DescSort ? OrderByType.Desc : OrderByType.Asc)
|
|
|
|
|
//.OrderByIF(input.SortField == "name", o => o.Name, input.DescSort ? OrderByType.Desc : OrderByType.Asc)
|
|
|
|
|
//.OrderByIF(input.SortField == "ip", o => o.Ip, input.DescSort ? OrderByType.Desc : OrderByType.Asc)
|
|
|
|
|
.Select(o => new OpLogPageListDto()
|
|
|
|
|
{
|
|
|
|
|
Id = o.Id,
|
|
|
|
|