修改首页睡眠数据查询逻辑
This commit is contained in:
@@ -22,6 +22,14 @@ public interface WatchMapper {
|
||||
@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);
|
||||
|
||||
/**
|
||||
* 查询最新的长睡睡眠时间和时长
|
||||
* @param id 用户ID
|
||||
* @return
|
||||
*/
|
||||
@Select("SELECT long_duration_total minutes, data_date dataDate FROM watch_stat_user_info_day_sleep WHERE user_id = #{id} and long_duration_total > 0 ORDER BY data_date DESC LIMIT 1;")
|
||||
WatchDataDTO getDataSleepNew(@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})")
|
||||
Double getAverageSleep(@Param("id") String id);
|
||||
|
||||
|
||||
+1
-1
@@ -323,7 +323,7 @@ public class WatchServiceImpl implements IWatchService {
|
||||
}
|
||||
switch (itemVo.getWdType()) {
|
||||
case "sleep":
|
||||
return watchMapper::getDataSleep;
|
||||
return watchMapper::getDataSleepNew;
|
||||
case "steps":
|
||||
return watchMapper::getDataSteps;
|
||||
case "heart_rate":
|
||||
|
||||
Reference in New Issue
Block a user