|
@ -71,14 +71,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
|
|
select * from behavior_detection where behavior_type = #{behaviorType} and water_intake is null order by create_time desc limit 1 |
|
|
select * from behavior_detection where behavior_type = #{behaviorType} and water_intake is null order by create_time desc limit 1 |
|
|
</select> |
|
|
</select> |
|
|
<select id="behaviorTypeCount" resultType="java.util.Map"> |
|
|
<select id="behaviorTypeCount" resultType="java.util.Map"> |
|
|
select behavior_type as behaviorType, |
|
|
|
|
|
CASE |
|
|
SELECT |
|
|
WHEN behavior_type = 1 THEN '饮水' |
|
|
'饮水' AS behaviorTypeName, |
|
|
WHEN behavior_type = 2 THEN '睡眠' |
|
|
COUNT(CASE WHEN behaviorSum > 1000 THEN 1 END) AS behaviorCount, -- 统计饮水量大于1000的数量 |
|
|
WHEN behavior_type = 3 THEN '行走' |
|
|
COUNT(CASE WHEN behaviorSum < 1000 THEN 1 END) AS behaviorCount1 -- 统计饮水量小于1000的数量 |
|
|
WHEN behavior_type = 4 THEN '坐姿' |
|
|
FROM ( |
|
|
ELSE '未知' |
|
|
|
|
|
END AS behaviorTypeName, COUNT(id) as behaviorCount from behavior_detection GROUP BY behavior_type |
|
|
SELECT |
|
|
|
|
|
face_name AS faceName, |
|
|
|
|
|
SUM( id ) AS behaviorSum |
|
|
|
|
|
FROM |
|
|
|
|
|
behavior_detection |
|
|
|
|
|
WHERE |
|
|
|
|
|
behavior_type = 1 |
|
|
|
|
|
AND date_format(create_time,'%y%m%d') >= date_format(now(),'%y%m%d') |
|
|
|
|
|
GROUP BY |
|
|
|
|
|
face_id,face_name |
|
|
|
|
|
) b |
|
|
</select> |
|
|
</select> |
|
|
<select id="behaviorCount" resultType="java.util.Map"> |
|
|
<select id="behaviorCount" resultType="java.util.Map"> |
|
|
select face_name as faceName,COUNT(id) as behaviorCount , |
|
|
select face_name as faceName,COUNT(id) as behaviorCount , |
|
|