diff --git a/FrontendWebApi/ApiControllers/DeviceManageController.cs b/FrontendWebApi/ApiControllers/DeviceManageController.cs index 08b7bde..3f9b227 100644 --- a/FrontendWebApi/ApiControllers/DeviceManageController.cs +++ b/FrontendWebApi/ApiControllers/DeviceManageController.cs @@ -154,7 +154,7 @@ namespace FrontendWebApi.ApiControllers { var sqlString = $@"select f.full_name as floor_tag from sub_system_floor ssf - join floor f on ssf.floor_tag = f.full_name and f.deleted = 0 + join floor f on ssf.floor_tag = f.full_name and ssf.building_tag = f.building_tag and f.deleted = 0 where ssf.deleted = 0 and f.building_tag = @building_tag and sub_system_tag = @sub_system_tag order by f.priority"; var param = new { @building_tag = fd.building_tag, @sub_system_tag = fd.sub_system_tag }; var fl = await backendRepository.GetAllAsync(sqlString, param); @@ -198,8 +198,11 @@ namespace FrontendWebApi.ApiControllers try { - var sqlString = $@"select full_name, InitMapName as map_name, concat(floor_map_name,'.svg') as floor_map_name from floor where deleted = 0 and building_tag = @building_tag and full_name = ifnull(@floor_tag, full_name)"; - var param = new { @building_tag = fd.building_tag, @floor_tag = fd.floor_tag }; + var sqlString = $@"select f.full_name, f.InitMapName as map_name, concat(f.floor_map_name,'.svg') as floor_map_name + from sub_system_floor ssf + join floor f on ssf.floor_tag = f.full_name and ssf.building_tag = f.building_tag and f.deleted = 0 + where ssf.deleted = 0 and ssf.building_tag = @building_tag and ssf.sub_system_tag = @sub_system_tag and ssf.floor_tag = ifnull(@floor_tag, ssf.floor_tag);"; + var param = new { @building_tag = fd.building_tag, @floor_tag = fd.floor_tag, @sub_system_tag = fd.sub_system_tag }; var fl = await backendRepository.GetAllAsync(sqlString, param); foreach (var f in fl)