mirror of
https://gitee.com/js-yhsec/energy_storage.git
synced 2026-05-27 18:59:26 +08:00
修改运行监控场站及设备信息查询接口
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user