|
|
@@ -160,11 +160,11 @@ namespace DataVAPI.ServerDB.MongoDB |
|
|
|
{ |
|
|
|
if (string.IsNullOrEmpty(deviceId)) |
|
|
|
{ |
|
|
|
return collection.Find(a => a.ClientId == clientId)?.ToList().OrderByDescending(a => a.CreateTime).ToList(); |
|
|
|
return collection.Find(a => a.ClientId == clientId)?.ToList().OrderByDescending(a => a.CreateTime)?.ToList(); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
return collection.Find(a => a.ClientId == clientId && a.DeviceId == deviceId)?.ToList().OrderByDescending(a => a.CreateTime).ToList(); |
|
|
|
return collection.Find(a => a.ClientId == clientId && a.DeviceId == deviceId)?.ToList().OrderByDescending(a => a.CreateTime)?.ToList(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@@ -177,22 +177,23 @@ namespace DataVAPI.ServerDB.MongoDB |
|
|
|
|
|
|
|
public List<T> QueryClientIdNew(string clientId) |
|
|
|
{ |
|
|
|
return collection.Find(a => a.ClientId == clientId && a.State == "y")?.ToList().OrderByDescending(a => a.CreateTime).ToList(); |
|
|
|
return collection.Find(a => a.ClientId == clientId && a.State == "y")?.ToList().OrderByDescending(a => a.CreateTime)?.ToList(); |
|
|
|
} |
|
|
|
|
|
|
|
public List<T> QueryClientId(string clientId) |
|
|
|
{ |
|
|
|
return collection.Find(a => a.ClientId == clientId && a.CreateTime >= DateTime.Now.Date && a.State == "y")?.ToList().OrderByDescending(a => a.CreateTime).ToList(); |
|
|
|
return collection.Find(a => a.ClientId == clientId && a.CreateTime >= DateTime.Now.Date && a.State == "y")?.ToList().OrderByDescending(a => a.CreateTime)?.ToList(); |
|
|
|
} |
|
|
|
|
|
|
|
public T QueryClientIdMax(string clientId) |
|
|
|
{ |
|
|
|
return collection.Find(a => a.ClientId == clientId && a.CreateTime >= DateTime.Now.AddDays(-1).Date && a.State == "y")?.ToList().OrderByDescending(a => a.CreateTime).ToList()[0]; |
|
|
|
List<T> clo = collection.Find(a => a.ClientId == clientId && a.CreateTime >= DateTime.Now.Date && a.State == "y")?.ToList().OrderByDescending(a => a.CreateTime)?.ToList(); |
|
|
|
return clo.Count>0?clo[0]:null; |
|
|
|
} |
|
|
|
|
|
|
|
public List<T> QueryDeviceId(string clientId, string deviceId) |
|
|
|
{ |
|
|
|
return collection.Find(a => a.DeviceId == deviceId && a.ClientId == clientId && a.CreateTime >= DateTime.Now.Date && a.State == "y")?.ToList().OrderByDescending(a => a.CreateTime).ToList(); |
|
|
|
return collection.Find(a => a.DeviceId == deviceId && a.ClientId == clientId && a.CreateTime >= DateTime.Now.Date && a.State == "y")?.ToList().OrderByDescending(a => a.CreateTime)?.ToList(); |
|
|
|
} |
|
|
|
|
|
|
|
public List<T> QueryAll() |
|
|
|