diff --git a/Backend/Controllers/SystemCategoryController.cs b/Backend/Controllers/SystemCategoryController.cs index 271e3f1..b4bf6fb 100644 --- a/Backend/Controllers/SystemCategoryController.cs +++ b/Backend/Controllers/SystemCategoryController.cs @@ -443,7 +443,7 @@ namespace Backend.Controllers LEFT JOIN building b ON bm.building_tag = b.building_tag AND b.deleted = 0 LEFT JOIN variable sv ON bm.sub_system_tag = sv.system_value AND sv.deleted = 0 LEFT JOIN variable mv ON sv.system_parent_id = mv.id AND mv.deleted = 0 - WHERE sv.id = @id"; + WHERE sv.id = @id and bm.is_link > 0"; var buildMenus = await backendRepository.GetAllAsync(sbuildMenu, new { id = id }); if (buildMenus.Count > 0) @@ -455,14 +455,13 @@ namespace Backend.Controllers } //檢查是否有未刪除的系統小類樓層 - var ssubSystemFloor = $@"SELECT - CONCAT(b.full_name, ' - ', mv.full_name, ' - ', sv.full_name, ' - ', f.full_name) + var ssubSystemFloor = $@"SELECT CONCAT(b.full_name, '-', mv.system_key, '-', sv.system_key, '-', f.full_name) FROM sub_system_floor ssf LEFT JOIN building b ON ssf.building_tag = b.building_tag AND b.deleted = 0 LEFT JOIN variable sv ON sv.system_value = ssf.sub_system_tag AND sv.deleted = 0 LEFT JOIN variable mv ON sv.system_parent_id = mv.id AND mv.deleted = 0 - LEFT JOIN floor f ON ssf.floor_guid = f.floor_guid AND f.deleted = 0 - WHERE sv.id = @id AND ssf.deleted = 0"; + LEFT JOIN floor f ON ssf.floor_tag = f.full_name AND f.deleted = 0 + WHERE sv.id = @id AND ssf.deleted = 0 and is_link = 1"; var subSystemFloor = await backendRepository.GetAllAsync(sbuildMenu, new { id = id }); if (subSystemFloor.Count > 0) @@ -478,7 +477,7 @@ namespace Backend.Controllers di.full_name FROM device_item di INNER JOIN variable sv on di.device_name_tag = sv.system_value - WHERE sv.deleted = 0 AND sv.id = @id AND di.deleted = 0"; + WHERE sv.deleted = 0 AND sv.id = @id AND di.deleted = 0 and di.is_link = 1"; var deviceItems = await backendRepository.GetAllAsync(sdeviceItem, new { id = id }); if (deviceItems.Count > 0) diff --git a/Backend/Controllers/UserInfoController.cs b/Backend/Controllers/UserInfoController.cs index 47d6a6a..4d042d3 100644 --- a/Backend/Controllers/UserInfoController.cs +++ b/Backend/Controllers/UserInfoController.cs @@ -523,6 +523,7 @@ namespace Backend.Controllers var sqlString = @$" SELECT ap.AuthCode, ap.MainName, ap.SubName, ap.ShowView FROM auth_page ap WHERE ap.AuthType='{post.SelectedAuthType}' {buildingGuid} + and ap.subname is not null and ap.showview is not null AND ap.AuthCode NOT IN ( SELECT ra.AuthCode FROM role_auth ra LEFT JOIN auth_page ap ON ra.AuthCode = ap.AuthCode