| 
					
				 | 
			
			
				@@ -871,7 +871,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         select distinct d.DEVICE_CODE 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         FROM sms_scene_type st 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         LEFT JOIN sms_scene s ON s.SCENE_TYPE_ID = st.ID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        LEFT JOIN sms_device_scene ds ON ds.PARENT_SCENE_ID = s.ID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        LEFT JOIN sms_device_scene ds ON (ds.PARENT_SCENE_ID = s.ID or ds.SCENE_ID = s.ID) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         LEFT JOIN sms_device d ON d.id = ds.DEVICE_ID 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         WHERE st.`STATUS` = 1 AND s.`STATUS` = 1 AND ds.`STATUS` = 1 AND d.`STATUS` = 1 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         <if test="companyOrgId != null"> 
			 |