[後端] 修改historyapi

This commit is contained in:
dev02 2023-05-16 14:43:47 +08:00
parent 81dc79f31c
commit d8ec06a859

View File

@ -956,29 +956,28 @@ namespace FrontendWebApi.ApiControllers
//依據被選擇的設備找出相對應資料 //依據被選擇的設備找出相對應資料
var sqlDeviceItemInfo = $@"select var sqlDeviceItemInfo = $@"select
b.full_name as building_name, b.full_name as building_name,
v1.system_key as Main_system_name, v1.system_key as Main_system_name,
v2.system_key as Sub_system_name, v2.system_key as Sub_system_name,
temp.device_number, temp.device_number,
temp.device_name, temp.device_name,
temp.full_name as item_name, temp.full_name as item_name,
temp.points, temp.points,
temp.unit temp.unit
from ( from (
select select
di.*, di.*,
d.device_building_tag, d.device_number,
d.device_number, d.full_name as device_name,
d.full_name as device_name, d.priority
d.priority from device_item di
from device_item di inner join device d on di.device_name_tag = d.device_name_tag and d.deleted = 0
inner join device d on di.device_name_tag = d.device_name_tag and d.deleted = 0 where di.deleted = 0 and di.unit is not null and d.device_number IN @Device_number
where di.deleted = 0 and di.unit is not null and d.device_number IN @Device_number ) temp
) temp inner join building b on temp.device_building_tag COLLATE utf8mb4_unicode_ci = b.building_tag and b.deleted = 0
inner join building b on temp.device_building_tag = b.building_tag and b.deleted = 0 inner join variable v1 on temp.device_system_tag COLLATE utf8mb4_unicode_ci = v1.system_value and v1.deleted = 0 and v1.system_type = 'device_system_category_layer2'
inner join variable v1 on temp.device_system_tag = v1.system_value and v1.deleted = 0 and v1.system_type = 'device_system_category_layer2' inner join variable v2 on temp.device_name_tag COLLATE utf8mb4_unicode_ci = v2.system_value and v2.deleted = 0 and v2.system_type = 'device_system_category_layer3'
inner join variable v2 on temp.device_name_tag = v2.system_value and v2.deleted = 0 and v2.system_type = 'device_system_category_layer3' order by b.priority, v1.system_priority, v2.system_priority, temp.priority;";
order by b.priority, v1.system_priority, v2.system_priority, temp.priority";
var device_item_infos = await frontendRepository.GetAllAsync<DeviceItemInfo>(sqlDeviceItemInfo, new { Device_number = device_numbers }); var device_item_infos = await frontendRepository.GetAllAsync<DeviceItemInfo>(sqlDeviceItemInfo, new { Device_number = device_numbers });