diff --git a/Backend/Controllers/DeviceManageController.cs b/Backend/Controllers/DeviceManageController.cs index 40e97d2..75f31b9 100644 --- a/Backend/Controllers/DeviceManageController.cs +++ b/Backend/Controllers/DeviceManageController.cs @@ -56,15 +56,16 @@ namespace Backend.Controllers FROM building_menu bm JOIN building b ON bm.building_tag = b.building_tag AND b.deleted = 0 JOIN variable mv ON bm.main_system_tag = mv.system_value AND mv.deleted = 0 and mv.system_type = '{main_system_type}' - JOIN variable sv ON bm.sub_system_tag = sv.system_value AND sv.deleted = 0 and sv.system_type = '{sub_system_type}'"; + JOIN variable sv ON bm.sub_system_tag = sv.system_value AND sv.deleted = 0 and sv.system_type = '{sub_system_type}' + where bm.is_link = 1 "; if (!string.IsNullOrEmpty(filter)) { - sql += $@" WHERE ( + sql += $@" and ( b.full_name LIKE CONCAT('%', @Filter, '%') OR mv.system_key LIKE CONCAT('%', @Filter, '%') OR sv.system_key LIKE CONCAT('%', @Filter, '%') - )"; + ) "; } sql += $@" ORDER BY b.priority, mv.system_priority, bm.priority, sv.system_priority, sv.created_at DESC"; @@ -109,6 +110,17 @@ namespace Backend.Controllers foreach (var buildingMenus_Sub_system_tag in buildingMenus_Group_Sub_system_tag) { + if (main_System.Main_system_tag == "S") + { + string name = buildingMenus_Sub_system_tag.First().sFull_name; + if (name == "人流計數") + { + bool check = buildingMenus_Sub_system_tag.Key.StartsWith(buildingMenus_Building_tag.Key[0]); + + if (!check) + continue; //跳回圈 + } + } Sub_system sub_System = new Sub_system(); sub_System.Sub_system_tag = buildingMenus_Sub_system_tag.Key; sub_System.Full_name = buildingMenus_Sub_system_tag.First().sFull_name;