Showing
1 changed file
with
9 additions
and
13 deletions
... | ... | @@ -74,7 +74,7 @@ |
74 | 74 | <include refid="basicColumns"/> |
75 | 75 | ,ifdp.name AS profile_name,ifdp.transport_type |
76 | 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 | 78 | </sql> |
79 | 79 | <select id="getDevicePage" resultMap="deviceMap"> |
80 | 80 | SELECT |
... | ... | @@ -82,12 +82,10 @@ |
82 | 82 | FROM iotfs_device ifd |
83 | 83 | LEFT JOIN device_profile ifdp ON ifd.profile_id = ifdp.id::TEXT |
84 | 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 | 89 | LEFT JOIN device d ON d.id::TEXT = ifd.tb_device_id |
92 | 90 | LEFT JOIN customer cus ON cus.id = d.customer_id |
93 | 91 | <where> |
... | ... | @@ -136,12 +134,10 @@ |
136 | 134 | FROM iotfs_device ifd |
137 | 135 | LEFT JOIN device_profile ifdp ON ifd.profile_id = CAST (ifdp.id AS VARCHAR) |
138 | 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 | 141 | LEFT JOIN device d ON d.id::TEXT = ifd.tb_device_id |
146 | 142 | LEFT JOIN iotfs_device idg ON idg.id = ifd.gateway_id |
147 | 143 | <where> | ... | ... |