| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -139,7 +139,8 @@ public interface CollectionParamsManageMapper extends BaseMapper<CollectionParam | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            " and csr.area_id = #{areaId} ") | 
					 | 
					 | 
					 | 
					            " and csr.area_id = #{areaId} ") | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    List<CollectionParamsManage> selectByAreaId(@Param("areaId") String areaId); | 
					 | 
					 | 
					 | 
					    List<CollectionParamsManage> selectByAreaId(@Param("areaId") String areaId); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    @Select("select " + | 
					 | 
					 | 
					 | 
					    @Select("WITH ranked_data AS ( " + | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            "    SELECT  " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            "        csr.house_id,  " + | 
					 | 
					 | 
					 | 
					            "        csr.house_id,  " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            "        hi.house_name,  " + | 
					 | 
					 | 
					 | 
					            "        hi.house_name,  " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            "        cpm.other_name,  " + | 
					 | 
					 | 
					 | 
					            "        cpm.other_name,  " + | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -149,27 +150,46 @@ public interface CollectionParamsManageMapper extends BaseMapper<CollectionParam | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            "        dl.status,  " + | 
					 | 
					 | 
					 | 
					            "        dl.status,  " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            "        hi.order_num,  " + | 
					 | 
					 | 
					 | 
					            "        hi.order_num,  " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            "        cpm.param_type,  " + | 
					 | 
					 | 
					 | 
					            "        cpm.param_type,  " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            " case " + | 
					 | 
					 | 
					 | 
					            "        CASE  " + | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            "  when ar.create_time >= CURRENT_DATE " + | 
					 | 
					 | 
					 | 
					            "            WHEN ar.create_time >= CURRENT_DATE AND ar.create_time < CURRENT_DATE + interval '1 day'  " + | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            "  and ar.create_time < CURRENT_DATE + interval '1 day' then 1 " + | 
					 | 
					 | 
					 | 
					            "            THEN 1  " + | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            "  else 0 " + | 
					 | 
					 | 
					 | 
					            "            ELSE 0  " + | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            " end as alarm_status " + | 
					 | 
					 | 
					 | 
					            "        END as alarm_status, " + | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            "from " + | 
					 | 
					 | 
					 | 
					            "        ROW_NUMBER() OVER ( " + | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            "            PARTITION BY csr.house_id  " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            "            ORDER BY  " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            "                CASE WHEN ar.create_time >= CURRENT_DATE AND ar.create_time < CURRENT_DATE + interval '1 day' THEN 0 ELSE 1 END, " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            "                cpm.cur_time DESC " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            "        ) as row_num " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            "    FROM  " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            "        cpm_space_relation csr  " + | 
					 | 
					 | 
					 | 
					            "        cpm_space_relation csr  " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            "join collection_params_manage cpm on " + | 
					 | 
					 | 
					 | 
					            "        JOIN collection_params_manage cpm ON csr.cpm_id = cpm.id  " + | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            " csr.cpm_id = cpm.id " + | 
					 | 
					 | 
					 | 
					            "        RIGHT JOIN house_info hi ON csr.house_id = hi.id  " + | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            "join house_info hi on " + | 
					 | 
					 | 
					 | 
					            "        JOIN device_ledger dl ON dl.id = cpm.device_ledger_id  " + | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            " csr.house_id = hi.id " + | 
					 | 
					 | 
					 | 
					            "        LEFT JOIN alarm_records ar ON ar.cpm_id = cpm.id  " + | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            "join device_ledger dl on " + | 
					 | 
					 | 
					 | 
					            "    WHERE  " + | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            " dl.id = cpm.device_ledger_id " + | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            "left join alarm_records ar on  " + | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            " ar.cpm_id = cpm.id " + | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            "where " + | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            "        csr.floor_id = #{floorId}  " + | 
					 | 
					 | 
					 | 
					            "        csr.floor_id = #{floorId}  " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            " and hi.floor_id = #{floorId} " + | 
					 | 
					 | 
					 | 
					            "        AND hi.floor_id = #{floorId}  " + | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            " and cpm.param_type = #{paramType} " + | 
					 | 
					 | 
					 | 
					            "        AND cpm.param_type = #{paramType}  " + | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            " and cpm.system_type = #{systemType}" + | 
					 | 
					 | 
					 | 
					            "        AND cpm.system_type = #{systemType} " + | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            " order by hi.order_num ; ") | 
					 | 
					 | 
					 | 
					            ") " + | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            "SELECT  " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            "    house_id,  " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            "    house_name,  " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            "    other_name,  " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            "    cur_value,  " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            "    cur_time,  " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            "    cpm_id,  " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            "    status,  " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            "    order_num,  " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            "    param_type,  " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            "    alarm_status " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            "FROM  " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            "    ranked_data " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            "WHERE  " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            "    row_num = 1 " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            "ORDER BY  " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            "    order_num; ") | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    List<TempHumidityDTO> selectByParamType(@Param("systemType") String systemType, | 
					 | 
					 | 
					 | 
					    List<TempHumidityDTO> selectByParamType(@Param("systemType") String systemType, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                            @Param("floorId") String floorId, | 
					 | 
					 | 
					 | 
					                                            @Param("floorId") String floorId, | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                            @Param("paramType") String paramType); | 
					 | 
					 | 
					 | 
					                                            @Param("paramType") String paramType); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -307,4 +327,15 @@ public interface CollectionParamsManageMapper extends BaseMapper<CollectionParam | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    @Update("update collection_params_manage set cur_value = #{curValue}, cur_time = #{curTime} where id = #{id} ") | 
					 | 
					 | 
					 | 
					    @Update("update collection_params_manage set cur_value = #{curValue}, cur_time = #{curTime} where id = #{id} ") | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    void updateCurValueById(@Param("id") String id, @Param("curValue") BigDecimal curValue, @Param("curTime") Date curTime); | 
					 | 
					 | 
					 | 
					    void updateCurValueById(@Param("id") String id, @Param("curValue") BigDecimal curValue, @Param("curTime") Date curTime); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    @Select("select" + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            " device_ledger_id " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            "from" + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            " collection_params_manage cpm " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            "where" + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            " is_use = 0 " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            " and date(cur_time) != date(current_timestamp) " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            " and device_ledger_id is not null " + | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            " group by device_ledger_id;") | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    List<String> OffLine(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
					 | 
					 | 
					
  |