diff --git a/FrontendWebApi/ApiControllers/HistoryController.cs b/FrontendWebApi/ApiControllers/HistoryController.cs index 3d3da33..a3ff0fa 100644 --- a/FrontendWebApi/ApiControllers/HistoryController.cs +++ b/FrontendWebApi/ApiControllers/HistoryController.cs @@ -210,7 +210,7 @@ namespace FrontendWebApi.ApiControllers where c.account = @account order by v1.system_priority, v2.system_priority", new { @account = myUser.account, @sub_system_type = sub_system_type, @main_system_type = main_system_type }); var dbbuilding = await frontendRepository.GetAllAsync( - @$"select distinct d.building_guid,d.full_name,d.priority from role_auth a + @$"select distinct d.building_tag,d.full_name,d.priority from role_auth a join auth_page b on a.AuthCode = b.AuthCode join userinfo c on c.role_guid = a.role_guid join building d on d.building_tag = b.building_tag @@ -335,7 +335,7 @@ namespace FrontendWebApi.ApiControllers wheres.Add("d.deleted = 0"); if (postDevice.SelectBuildings != null && postDevice.SelectBuildings.Count() > 0) { - wheres.Add("d.building_tag in @builds"); + wheres.Add("d.device_building_tag in @builds"); } if (postDevice.SelectFloors != null && postDevice.SelectFloors.Count() > 0) @@ -360,15 +360,14 @@ namespace FrontendWebApi.ApiControllers b.full_name building_name, v1.system_key main_name, v2.system_key sub_name, - d.full_name sub_name, a.full_name device_name, a.device_number from (SELECT * FROM device d WHERE {wheres_str}) a - join building b on b.building_tag = a.building_tag + join building b on b.building_tag = a.device_building_tag join variable v1 on v1.system_value = a.device_system_tag and v1.deleted = 0 and v1.system_type = 'device_system_category_layer2' - join variable v2 on v2.system_value = a.device_system_tag and v2.deleted = 0 and v2.system_type = 'device_system_category_layer3' + join variable v2 on v2.system_value = a.device_name_tag and v2.deleted = 0 and v2.system_type = 'device_system_category_layer3' order by b.priority,v1.system_priority,v2.system_priority,a.priority"; var dbDevice = await backendRepository.GetAllAsync(sql, new { builds = postDevice.SelectBuildings, floor_guid = postDevice.SelectFloors, syss = postDevice.SelectSub, device_name = postDevice.Device_name }); @@ -405,9 +404,9 @@ namespace FrontendWebApi.ApiControllers @$"select c.full_name building_name,b.device_number,b.full_name device_name,a.full_name item_name,a.points,a.unit from device_item a join device b on a.device_system_tag = b.device_system_tag - join building c on c.building_tag = b.building_tag + join building c on c.building_tag = b.device_building_tag join variable v1 on v1.system_value = b.device_system_tag and v1.deleted = 0 and v1.system_type = 'device_system_category_layer2' - join variable v2 on v2.system_value = b.device_system_tag and v2.deleted = 0 and v2.system_type = 'device_system_category_layer3' + join variable v2 on v2.system_value = b.device_name_tag and v2.deleted = 0 and v2.system_type = 'device_system_category_layer3' where a.deleted = 0 and b.deleted = 0 and v2.deleted = 0 and v1.deleted = 0 and a.unit is not null and b.device_number in @Device_number order by c.priority,b.priority