修改运行监控场站及设备信息查询接口

This commit is contained in:
lixiaoyuan
2025-09-06 15:23:07 +08:00
parent aca9a8f0ae
commit 566a3b050c
17 changed files with 468 additions and 302 deletions

View File

@@ -42,7 +42,7 @@ void Station::setFields(Fields& fields)
void Station::addDevice(int deviceId, std::shared_ptr<Device> device)
{
mapDevice[deviceId] = device;
mapDeviceGroupNum[device->group]++;
mapDeviceGroup[device->category].push_back(device);
}
std::shared_ptr<Device> Station::getDevice(int deviceId)
@@ -67,20 +67,17 @@ void Station::getDeviceByType(int typeId, std::vector<std::shared_ptr<Device>>&
}
}
int Station::getDeviceNumByGroup(std::string name)
int Station::getDeviceNumByGroup(int category)
{
return mapDeviceGroupNum[name];
return 0;
}
void Station::getDeviceByGroup(std::string name, std::vector<std::shared_ptr<Device>>& res)
void Station::getDeviceByGroup(int category, std::vector<std::shared_ptr<Device>>& res)
{
for (auto iter = mapDevice.begin(); iter!=mapDevice.end(); ++iter)
auto iter = mapDeviceGroup.find(category);
if (iter != mapDeviceGroup.end())
{
auto device = iter->second;
if (device->group == name)
{
res.push_back(device);
}
res = iter->second;
}
}