临时修复首页睡眠数据bug

This commit is contained in:
feng
2025-12-09 09:56:28 +08:00
parent 9916e792db
commit f73a09e91c
@@ -19,7 +19,7 @@ public interface WatchMapper {
@Select("SELECT DATEDIFF(NOW(), (SELECT bind_date FROM watch_bind_his WHERE bind_user_id = #{id} ORDER BY bind_date DESC limit 1)) AS days") @Select("SELECT DATEDIFF(NOW(), (SELECT bind_date FROM watch_bind_his WHERE bind_user_id = #{id} ORDER BY bind_date DESC limit 1)) AS days")
Integer getUseDays(@Param("id") String id); Integer getUseDays(@Param("id") String id);
@Select("select length(nm.status) minutes,DATE_FORMAT(n.data_date,'%Y-%m-%d') dataDate from watch_data_sleep_new_minute nm left join watch_data_sleep_new n on nm.sleep_id = n.id where n.id = ( select id from watch_data_sleep_new WHERE bind_user_id = #{id} order by data_date desc limit 1) and nm.sleep_type = '2' limit 1") @Select("select length(nm.status) minutes,DATE_FORMAT(n.data_date,'%Y-%m-%d') dataDate from watch_data_sleep_new_minute nm left join watch_data_sleep_new n on nm.sleep_id = n.id where n.id = ( select id from watch_data_sleep_new WHERE bind_user_id = #{id} order by data_date desc limit 1) and nm.STATUS not like '%55%' limit 1")
WatchDataDTO getDataSleep(@Param("id") String id); WatchDataDTO getDataSleep(@Param("id") String id);
@Select("SELECT AVG(TIMESTAMPDIFF(MINUTE, d.fall_asleep_time, d.wake_up_time)) AS aveMinute FROM watch_data_sleep_new_day d LEFT JOIN watch_data_sleep_new n ON d.sleep_id = n.id WHERE n.id IN (SELECT id FROM watch_data_sleep_new WHERE bind_user_id = #{id})") @Select("SELECT AVG(TIMESTAMPDIFF(MINUTE, d.fall_asleep_time, d.wake_up_time)) AS aveMinute FROM watch_data_sleep_new_day d LEFT JOIN watch_data_sleep_new n ON d.sleep_id = n.id WHERE n.id IN (SELECT id FROM watch_data_sleep_new WHERE bind_user_id = #{id})")