Merge remote-tracking branch 'origin/xc' into xc

This commit is contained in:
2026-06-25 15:50:57 +08:00
@@ -52,22 +52,22 @@
(select #{id,jdbcType=VARCHAR}, (select #{id,jdbcType=VARCHAR},
s.bind_user_id, s.bind_user_id,
count(case when sm.sleep_type = '1' then 1 end) as long_count, count(case when sm.sleep_type = '1' then 1 end) as long_count,
max(case when sm.sleep_type = '1' then time_to_sec(timediff(sm.end_time, sm.start_time)) end) / max(case when sm.sleep_type = '1' then TIMESTAMPDIFF(SECOND, sm.start_time, sm.end_time) end) /
60 as long_duration_max, 60 as long_duration_max,
min(case when sm.sleep_type = '1' then time_to_sec(timediff(sm.end_time, sm.start_time)) end) / min(case when sm.sleep_type = '1' then TIMESTAMPDIFF(SECOND, sm.start_time, sm.end_time) end) /
60 as long_duration_min, 60 as long_duration_min,
sum(case when sm.sleep_type = '1' then time_to_sec(timediff(sm.end_time, sm.start_time)) end) / sum(case when sm.sleep_type = '1' then TIMESTAMPDIFF(SECOND, sm.start_time, sm.end_time) end) /
60 as long_duration_total, 60 as long_duration_total,
count(case when sm.sleep_type = '2' then 1 end) as short_count, count(case when sm.sleep_type = '2' then 1 end) as short_count,
max(case when sm.sleep_type = '2' then time_to_sec(timediff(sm.end_time, sm.start_time)) end) / max(case when sm.sleep_type = '2' then TIMESTAMPDIFF(SECOND, sm.start_time, sm.end_time) end) /
60 as short_duration_max, 60 as short_duration_max,
min(case when sm.sleep_type = '2' then time_to_sec(timediff(sm.end_time, sm.start_time)) end) / min(case when sm.sleep_type = '2' then TIMESTAMPDIFF(SECOND, sm.start_time, sm.end_time) end) /
60 as short_duration_min, 60 as short_duration_min,
sum(case when sm.sleep_type = '2' then time_to_sec(timediff(sm.end_time, sm.start_time)) end) / sum(case when sm.sleep_type = '2' then TIMESTAMPDIFF(SECOND, sm.start_time, sm.end_time) end) /
60 as short_duration_total, 60 as short_duration_total,
sum(length(sm.status) - length(replace(sm.status, '1', ''))) as deep_sleep_times, sum(length(sm.status) - length(replace(sm.status, '1', ''))) as deep_sleep_times,
sum(length(sm.status) - length(replace(sm.status, '3', ''))) as light_sleep_times, sum(length(sm.status) - length(replace(sm.status, '3', ''))) as light_sleep_times,
sum(time_to_sec(timediff(sm.end_time, sm.start_time))) / 60 as deep_light_times, sum(TIMESTAMPDIFF(SECOND, sm.start_time, sm.end_time)) / 60 as deep_light_times,
max(s.id) as sleep_id, max(s.id) as sleep_id,
max(sm.end_time) as last_upload_time, max(sm.end_time) as last_upload_time,
data_date, data_date,
@@ -85,22 +85,22 @@
update QH_WAT_STAT_USER_DAY_SLE stat update QH_WAT_STAT_USER_DAY_SLE stat
left join (select s.bind_user_id, left join (select s.bind_user_id,
count(case when sm.sleep_type = '1' then 1 end) as long_count, count(case when sm.sleep_type = '1' then 1 end) as long_count,
max(case when sm.sleep_type = '1' then time_to_sec(timediff(sm.end_time, sm.start_time)) end) / max(case when sm.sleep_type = '1' then TIMESTAMPDIFF(SECOND, sm.start_time, sm.end_time) end) /
60 as long_duration_max, 60 as long_duration_max,
min(case when sm.sleep_type = '1' then time_to_sec(timediff(sm.end_time, sm.start_time)) end) / min(case when sm.sleep_type = '1' then TIMESTAMPDIFF(SECOND, sm.start_time, sm.end_time) end) /
60 as long_duration_min, 60 as long_duration_min,
sum(case when sm.sleep_type = '1' then time_to_sec(timediff(sm.end_time, sm.start_time)) end) / sum(case when sm.sleep_type = '1' then TIMESTAMPDIFF(SECOND, sm.start_time, sm.end_time) end) /
60 as long_duration_total, 60 as long_duration_total,
count(case when sm.sleep_type = '2' then 1 end) as short_count, count(case when sm.sleep_type = '2' then 1 end) as short_count,
max(case when sm.sleep_type = '2' then time_to_sec(timediff(sm.end_time, sm.start_time)) end) / max(case when sm.sleep_type = '2' then TIMESTAMPDIFF(SECOND, sm.start_time, sm.end_time) end) /
60 as short_duration_max, 60 as short_duration_max,
min(case when sm.sleep_type = '2' then time_to_sec(timediff(sm.end_time, sm.start_time)) end) / min(case when sm.sleep_type = '2' then TIMESTAMPDIFF(SECOND, sm.start_time, sm.end_time) end) /
60 as short_duration_min, 60 as short_duration_min,
sum(case when sm.sleep_type = '2' then time_to_sec(timediff(sm.end_time, sm.start_time)) end) / sum(case when sm.sleep_type = '2' then TIMESTAMPDIFF(SECOND, sm.start_time, sm.end_time) end) /
60 as short_duration_total, 60 as short_duration_total,
sum(length(sm.status) - length(replace(sm.status, '1', ''))) as deep_sleep_times, sum(length(sm.status) - length(replace(sm.status, '1', ''))) as deep_sleep_times,
sum(length(sm.status) - length(replace(sm.status, '3', ''))) as light_sleep_times, sum(length(sm.status) - length(replace(sm.status, '3', ''))) as light_sleep_times,
sum(time_to_sec(timediff(sm.end_time, sm.start_time))) / 60 as deep_light_times, sum(TIMESTAMPDIFF(SECOND, sm.start_time, sm.end_time)) / 60 as deep_light_times,
max(s.id) as sleep_id, max(s.id) as sleep_id,
max(sm.end_time) as last_upload_time, max(sm.end_time) as last_upload_time,
data_date data_date