From c86a3e63f195de5b4fb7f0d054f279a8f9c29d9d Mon Sep 17 00:00:00 2001 From: dev02 Date: Fri, 18 Nov 2022 16:08:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=9B=A3=E6=8E=A7=E7=B3=BB?= =?UTF-8?q?=E7=B5=B1=E5=88=97=E8=A1=A8=E6=A8=93=E5=B1=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ApiControllers/DeviceManageController.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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";