加上时间筛选和取最近30条
This commit is contained in:
parent
2dd3a1b18c
commit
54c03916a8
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue