Compare commits
3 Commits
62af38cbf0
...
cc23f082a6
| Author | SHA1 | Date | |
|---|---|---|---|
| cc23f082a6 | |||
| 1bc7dc676e | |||
| 5cdacad468 |
@ -262,12 +262,12 @@
|
|||||||
d.online_status,
|
d.online_status,
|
||||||
c.binding_time,
|
c.binding_time,
|
||||||
d.create_time,
|
d.create_time,
|
||||||
ROW_NUMBER() OVER (PARTITION BY d.id ORDER BY c.binding_time) AS row_num
|
ROW_NUMBER() OVER (PARTITION BY d.id ORDER BY d.id) AS row_num
|
||||||
from device d
|
from device d
|
||||||
inner join device_type dt on d.device_type = dt.id
|
inner join device_type dt on d.device_type = dt.id
|
||||||
left join app_device_bind_record c on d.id = c.device_id
|
left join app_device_bind_record c on d.id = c.device_id
|
||||||
left join app_personnel_info ap on ap.device_id = d.id
|
left join app_personnel_info ap on ap.device_id = d.id
|
||||||
where dt.communication_mode in (0, 2) ) a where a.row_num = 1
|
where dt.communication_mode in (0, 2) ORDER BY (case when d.online_status = 1 then 2 else 1 end) DESC) a where a.row_num = 1
|
||||||
<if test="criteria.deviceType != null">
|
<if test="criteria.deviceType != null">
|
||||||
and a.device_type = #{criteria.deviceType}
|
and a.device_type = #{criteria.deviceType}
|
||||||
</if>
|
</if>
|
||||||
@ -298,7 +298,7 @@
|
|||||||
<if test="criteria.onlineStatus != null">
|
<if test="criteria.onlineStatus != null">
|
||||||
and a.online_status = #{criteria.onlineStatus}
|
and a.online_status = #{criteria.onlineStatus}
|
||||||
</if>
|
</if>
|
||||||
ORDER BY (case when a.online_status = 1 then 2 else 1 end) DESC
|
|
||||||
</select>
|
</select>
|
||||||
<select id="getLocationHistory" resultType="com.fuyuanshen.equipment.domain.vo.LocationHistoryVo">
|
<select id="getLocationHistory" resultType="com.fuyuanshen.equipment.domain.vo.LocationHistoryVo">
|
||||||
select a.id,a.device_name,a.device_type,b.type_name deviceTypeName,a.device_imei,a.device_mac from device a
|
select a.id,a.device_name,a.device_type,b.type_name deviceTypeName,a.device_imei,a.device_mac from device a
|
||||||
@ -478,7 +478,7 @@
|
|||||||
d.type_name AS deviceName,
|
d.type_name AS deviceName,
|
||||||
COUNT(*) AS frequency
|
COUNT(*) AS frequency
|
||||||
FROM device_log dl
|
FROM device_log dl
|
||||||
LEFT JOIN device d ON dl.device_id = d.id
|
INNER JOIN device d ON dl.device_id = d.id
|
||||||
WHERE dl.create_time >= DATE_SUB(NOW(), INTERVAL #{days} DAY)
|
WHERE dl.create_time >= DATE_SUB(NOW(), INTERVAL #{days} DAY)
|
||||||
GROUP BY d.device_type, d.type_name
|
GROUP BY d.device_type, d.type_name
|
||||||
ORDER BY frequency DESC
|
ORDER BY frequency DESC
|
||||||
|
|||||||
Reference in New Issue
Block a user