This commit is contained in:
2025-09-25 16:04:00 +08:00
parent 05b923b1ac
commit bb997857fd
14 changed files with 185 additions and 182 deletions

View File

@@ -48,6 +48,15 @@
<select id="countByUsername" resultType="int">
select count(1) from client_device where username = #{username}
</select>
<select id="selectOnlineDevices" resultMap="ClientDeviceMap">
select * from client_device where status = 'online' order by last_active_at desc
</select>
<update id="updateExpiredDevicesOffline">
update client_device set status = 'offline'
where status = 'online' and (last_active_at is null or last_active_at &lt; date_sub(now(), interval 2 minute))
</update>
</mapper>