[後端] 修改小類判斷關聯架構, 修改使用者增加區域選單錯誤

This commit is contained in:
dev02 2023-11-29 14:28:13 +08:00
parent 31fe9e0edb
commit 38a0fc6996
2 changed files with 6 additions and 6 deletions

View File

@ -443,7 +443,7 @@ namespace Backend.Controllers
LEFT JOIN building b ON bm.building_tag = b.building_tag AND b.deleted = 0 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 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 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<string>(sbuildMenu, new { id = id }); var buildMenus = await backendRepository.GetAllAsync<string>(sbuildMenu, new { id = id });
if (buildMenus.Count > 0) if (buildMenus.Count > 0)
@ -455,14 +455,13 @@ namespace Backend.Controllers
} }
//檢查是否有未刪除的系統小類樓層 //檢查是否有未刪除的系統小類樓層
var ssubSystemFloor = $@"SELECT var ssubSystemFloor = $@"SELECT CONCAT(b.full_name, '-', mv.system_key, '-', sv.system_key, '-', f.full_name)
CONCAT(b.full_name, ' - ', mv.full_name, ' - ', sv.full_name, ' - ', f.full_name)
FROM sub_system_floor ssf FROM sub_system_floor ssf
LEFT JOIN building b ON ssf.building_tag = b.building_tag AND b.deleted = 0 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 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 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 LEFT JOIN floor f ON ssf.floor_tag = f.full_name AND f.deleted = 0
WHERE sv.id = @id AND ssf.deleted = 0"; WHERE sv.id = @id AND ssf.deleted = 0 and is_link = 1";
var subSystemFloor = await backendRepository.GetAllAsync<string>(sbuildMenu, new { id = id }); var subSystemFloor = await backendRepository.GetAllAsync<string>(sbuildMenu, new { id = id });
if (subSystemFloor.Count > 0) if (subSystemFloor.Count > 0)
@ -478,7 +477,7 @@ namespace Backend.Controllers
di.full_name di.full_name
FROM device_item di FROM device_item di
INNER JOIN variable sv on di.device_name_tag = sv.system_value 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<string>(sdeviceItem, new { id = id }); var deviceItems = await backendRepository.GetAllAsync<string>(sdeviceItem, new { id = id });
if (deviceItems.Count > 0) if (deviceItems.Count > 0)

View File

@ -523,6 +523,7 @@ namespace Backend.Controllers
var sqlString = @$" SELECT ap.AuthCode, ap.MainName, ap.SubName, ap.ShowView FROM auth_page ap var sqlString = @$" SELECT ap.AuthCode, ap.MainName, ap.SubName, ap.ShowView FROM auth_page ap
WHERE ap.AuthType='{post.SelectedAuthType}' WHERE ap.AuthType='{post.SelectedAuthType}'
{buildingGuid} {buildingGuid}
and ap.subname is not null and ap.showview is not null
AND ap.AuthCode NOT IN ( AND ap.AuthCode NOT IN (
SELECT ra.AuthCode FROM role_auth ra SELECT ra.AuthCode FROM role_auth ra
LEFT JOIN auth_page ap ON ra.AuthCode = ap.AuthCode LEFT JOIN auth_page ap ON ra.AuthCode = ap.AuthCode