Переглянути джерело

调整接口调用错误

master
fyf 2 роки тому
джерело
коміт
2d6bc93a5d
1 змінених файлів з 7 додано та 6 видалено
  1. +7
    -6
      DataVAPI.ServerDB/MongoDB/MongodbHelper.cs

+ 7
- 6
DataVAPI.ServerDB/MongoDB/MongodbHelper.cs Переглянути файл

@@ -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()


Завантаження…
Відмінити
Зберегти