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);