From aad4e8e0f45d179535c59d7fb2e6c066fe5a7008 Mon Sep 17 00:00:00 2001 From: dev02 Date: Mon, 29 Jan 2024 17:07:23 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=BE=8C=E7=AB=AF]=20=E8=AA=BF=E6=95=B4?= =?UTF-8?q?=E6=95=B8=E6=93=9A=E8=B6=A8=E5=8B=A2=E7=8D=B2=E5=8F=96=E6=9D=B1?= =?UTF-8?q?=E5=88=A5=E7=A8=8B=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ApiControllers/HistoryController.cs | 31 +++++++++---------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/FrontendWebApi/ApiControllers/HistoryController.cs b/FrontendWebApi/ApiControllers/HistoryController.cs index d67aaf8..4480e65 100644 --- a/FrontendWebApi/ApiControllers/HistoryController.cs +++ b/FrontendWebApi/ApiControllers/HistoryController.cs @@ -352,12 +352,13 @@ 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_tag,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 - where c.account = @account and d.building_tag = @building_tag - order by d.priority + where c.account = @account and b.ShowView = 'DataAnalyst' + order by d.priority ", new { @account = myUser.account, @building_tag = hf.building_tag }); var mains = dbsub.GroupBy(a => a.main_system_tag).ToList(); apiResult.Data = new History_MainSubBuildFloor(); @@ -967,23 +968,19 @@ namespace FrontendWebApi.ApiControllers try { #region 取得區域樓層 - var sqlBuildingFloor = $@"SELECT - b.building_tag, - b.full_name AS building_name, - b.priority, + var sqlBuildingFloor = $@"select distinct d.building_tag, + d.full_name AS building_name, + d.priority, f.floor_guid, f.full_name AS floor_name, f.priority - FROM building b - JOIN floor f ON f.deleted = 0 AND f.building_tag = b.building_tag - WHERE b.building_tag IN ( - SELECT - ap.building_tag - FROM role_auth ra - JOIN auth_page ap ON ra.AuthCode = ap.AuthCode - JOIN userinfo u ON u.role_guid = ra.role_guid WHERE u.account = @Account - ) - ORDER BY b.priority, f.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 + JOIN floor f ON f.deleted = 0 AND f.building_tag = b.building_tag + where c.account = @account and b.ShowView = 'HistorySearch' + order by d.priority, f.priority;"; var buildingFloorRawDatas = await frontendRepository.GetAllAsync(sqlBuildingFloor, post);