| 
					
				 | 
			
			
				@@ -13,6 +13,7 @@ import com.zcxk.rmcp.api.dto.community.CommunityPageDto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.zcxk.rmcp.api.enums.RmcpErrorEnum; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.zcxk.rmcp.api.vo.CommunityVo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.zcxk.rmcp.core.dao.CommunityMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.zcxk.rmcp.core.dao.DeviceMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.zcxk.rmcp.core.entity.Community; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.zcxk.rmcp.web.service.CommunityService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import lombok.extern.slf4j.Slf4j; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -38,6 +39,9 @@ public class CommunityServiceImpl implements CommunityService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private CommunityMapper communityMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private DeviceMapper deviceMapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Override 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public int updateByPrimaryKeySelective(CommunityAddDto communityDto) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Community community = new Community(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -86,6 +90,10 @@ public class CommunityServiceImpl implements CommunityService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         community.setUpdateDate(LocalDateTime.now()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         community.setId(id); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         community.setStatus(StatusEnum.DELETE.getCode()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 小区有绑定设备就不能删除 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (deviceMapper.countDeviceByCommunityId(id) > 0 ){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            throw BusinessException.builder(RmcpErrorEnum.RMCP_UPDATE_FAIL.getStatus(), "删除失败,该小区已绑定设备!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         communityMapper.updateByPrimaryKeySelective(community); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |