diff --git a/langguanApi/Service/WasherService.cs b/langguanApi/Service/WasherService.cs index 7cc8907..3bfb6fd 100644 --- a/langguanApi/Service/WasherService.cs +++ b/langguanApi/Service/WasherService.cs @@ -66,6 +66,18 @@ namespace langguanApi.Service entity.StateString=item.State==0?"停止":"运行"; washerHistroyResult.Add(entity); } + if (!string.IsNullOrWhiteSpace(input.startTime)) + { + washerHistroyResult = washerHistroyResult.Where(p => Convert.ToDateTime(p.Time) >= Convert.ToDateTime(input.startTime)).ToList(); + } + if (!string.IsNullOrWhiteSpace(input.endTime)) + { + washerHistroyResult = washerHistroyResult.Where(p => Convert.ToDateTime(p.Time) <= Convert.ToDateTime(input.endTime)).ToList(); + } + if (washerHistroyResult.Any()) + { + washerHistroyResult = washerHistroyResult.OrderByDescending(p => p.Time).Take(30).ToList(); + } return washerHistroyResult; } }