Commit b24f8e162cc423eb9f1f2086527c17efb63b8772

Authored by 云中非
1 parent 6eda7687

fix(DEFECT-444): 设备状态信息异常问题

@@ -74,7 +74,7 @@ @@ -74,7 +74,7 @@
74 <include refid="basicColumns"/> 74 <include refid="basicColumns"/>
75 ,ifdp.name AS profile_name,ifdp.transport_type 75 ,ifdp.name AS profile_name,ifdp.transport_type
76 ,io.name AS organization_name 76 ,io.name AS organization_name
77 - ,a.bool_v status,a.last_update_ts status_time,b.long_v last_online_time,c.long_v last_offline_time 77 + ,a.bool_v status,b.long_v status_time,e.long_v last_online_time,c.long_v last_offline_time
78 </sql> 78 </sql>
79 <select id="getDevicePage" resultMap="deviceMap"> 79 <select id="getDevicePage" resultMap="deviceMap">
80 SELECT 80 SELECT
@@ -82,12 +82,10 @@ @@ -82,12 +82,10 @@
82 FROM iotfs_device ifd 82 FROM iotfs_device ifd
83 LEFT JOIN device_profile ifdp ON ifd.profile_id = ifdp.id::TEXT 83 LEFT JOIN device_profile ifdp ON ifd.profile_id = ifdp.id::TEXT
84 LEFT JOIN iotfs_organization io ON io.id = ifd.organization_id 84 LEFT JOIN iotfs_organization io ON io.id = ifd.organization_id
85 - LEFT JOIN attribute_kv a ON ifd.tb_device_id = a.entity_id::TEXT AND a.entity_type ='DEVICE' AND  
86 - a.attribute_key='active'  
87 - LEFT JOIN attribute_kv b ON ifd.tb_device_id = b.entity_id::TEXT AND b.entity_type ='DEVICE' AND  
88 - b.attribute_key='lastActivityTime'  
89 - LEFT JOIN attribute_kv c ON ifd.tb_device_id = c.entity_id::TEXT AND c.entity_type ='DEVICE' AND  
90 - c.attribute_key='inactivityAlarmTime' 85 + LEFT JOIN attribute_kv a ON ifd.tb_device_id = a.entity_id::TEXT AND a.entity_type ='DEVICE' AND a.attribute_key='active'
  86 + LEFT JOIN attribute_kv b ON ifd.tb_device_id = b.entity_id::TEXT AND b.entity_type ='DEVICE' AND b.attribute_key='lastActivityTime'
  87 + LEFT JOIN attribute_kv c ON ifd.tb_device_id = c.entity_id::TEXT AND c.entity_type ='DEVICE' AND c.attribute_key='lastDisconnectTime'
  88 + LEFT JOIN attribute_kv e ON ifd.tb_device_id = e.entity_id::TEXT AND e.entity_type ='DEVICE' AND e.attribute_key='lastConnectTime'
91 LEFT JOIN device d ON d.id::TEXT = ifd.tb_device_id 89 LEFT JOIN device d ON d.id::TEXT = ifd.tb_device_id
92 LEFT JOIN customer cus ON cus.id = d.customer_id 90 LEFT JOIN customer cus ON cus.id = d.customer_id
93 <where> 91 <where>
@@ -136,12 +134,10 @@ @@ -136,12 +134,10 @@
136 FROM iotfs_device ifd 134 FROM iotfs_device ifd
137 LEFT JOIN device_profile ifdp ON ifd.profile_id = CAST (ifdp.id AS VARCHAR) 135 LEFT JOIN device_profile ifdp ON ifd.profile_id = CAST (ifdp.id AS VARCHAR)
138 LEFT JOIN iotfs_organization io ON io.id = ifd.organization_id 136 LEFT JOIN iotfs_organization io ON io.id = ifd.organization_id
139 - LEFT JOIN attribute_kv a ON ifd.tb_device_id = a.entity_id::TEXT AND a.entity_type ='DEVICE' AND  
140 - a.attribute_key='active'  
141 - LEFT JOIN attribute_kv b ON ifd.tb_device_id = b.entity_id::TEXT AND b.entity_type ='DEVICE' AND  
142 - b.attribute_key='lastActivityTime'  
143 - LEFT JOIN attribute_kv c ON ifd.tb_device_id = c.entity_id::TEXT AND c.entity_type ='DEVICE' AND  
144 - c.attribute_key='inactivityAlarmTime' 137 + LEFT JOIN attribute_kv a ON ifd.tb_device_id = a.entity_id::TEXT AND a.entity_type ='DEVICE' AND a.attribute_key='active'
  138 + LEFT JOIN attribute_kv b ON ifd.tb_device_id = b.entity_id::TEXT AND b.entity_type ='DEVICE' AND b.attribute_key='lastActivityTime'
  139 + LEFT JOIN attribute_kv c ON ifd.tb_device_id = c.entity_id::TEXT AND c.entity_type ='DEVICE' AND c.attribute_key='lastDisconnectTime'
  140 + LEFT JOIN attribute_kv e ON ifd.tb_device_id = e.entity_id::TEXT AND e.entity_type ='DEVICE' AND e.attribute_key='lastConnectTime'
145 LEFT JOIN device d ON d.id::TEXT = ifd.tb_device_id 141 LEFT JOIN device d ON d.id::TEXT = ifd.tb_device_id
146 LEFT JOIN iotfs_device idg ON idg.id = ifd.gateway_id 142 LEFT JOIN iotfs_device idg ON idg.id = ifd.gateway_id
147 <where> 143 <where>