diff --git a/FrontendWebApi/ApiControllers/DeviceManageController.cs b/FrontendWebApi/ApiControllers/DeviceManageController.cs index 8832166..08b7bde 100644 --- a/FrontendWebApi/ApiControllers/DeviceManageController.cs +++ b/FrontendWebApi/ApiControllers/DeviceManageController.cs @@ -143,11 +143,20 @@ namespace FrontendWebApi.ApiControllers apiResult.Msg = "必須選擇東別"; return apiResult; } + else if (string.IsNullOrEmpty(fd.sub_system_tag)) + { + apiResult.Code = "0002"; + apiResult.Msg = "必須選擇小類系統"; + return apiResult; + } try { - var sqlString = $@"select full_name as floor_tag from floor where deleted = 0 and building_tag = @building_tag order by priority"; - var param = new { @building_tag = fd.building_tag }; + 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 + 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); apiResult.Code = "0000";