Browse Source

提交

mine
袁强 3 months ago
parent
commit
f53f8878d5
  1. 2
      yq-admin/src/main/java/yq/web/controller/nologin/NoLogin.java
  2. 2
      yq-system/src/main/java/yq/system/mapper/BehaviorDetectionMapper.java
  3. 2
      yq-system/src/main/java/yq/system/service/IBehaviorDetectionService.java
  4. 2
      yq-system/src/main/java/yq/system/service/impl/BehaviorDetectionServiceImpl.java
  5. 26
      yq-system/src/main/resources/mapper/system/BehaviorDetectionMapper.xml

2
yq-admin/src/main/java/yq/web/controller/nologin/NoLogin.java

@ -233,7 +233,7 @@ public class NoLogin extends BaseController {
} }
@GetMapping("/behaviorTypeCount") @GetMapping("/behaviorTypeCount")
public List<Map<String,Object>> behaviorTypeCount() public Map<String,Object> behaviorTypeCount()
{ {
return behaviorDetectionService.behaviorTypeCount(); return behaviorDetectionService.behaviorTypeCount();
} }

2
yq-system/src/main/java/yq/system/mapper/BehaviorDetectionMapper.java

@ -18,7 +18,7 @@ public interface BehaviorDetectionMapper {
void updateBehavior(BehaviorDetection behaviorDetection); void updateBehavior(BehaviorDetection behaviorDetection);
List<Map<String,Object>> behaviorTypeCount(); Map<String,Object> behaviorTypeCount();
List<Map<String,Object>> behaviorCount(); List<Map<String,Object>> behaviorCount();
} }

2
yq-system/src/main/java/yq/system/service/IBehaviorDetectionService.java

@ -18,7 +18,7 @@ public interface IBehaviorDetectionService {
void updateBehavior(BehaviorDetection behaviorDetection); void updateBehavior(BehaviorDetection behaviorDetection);
List<Map<String,Object>>behaviorTypeCount(); Map<String,Object>behaviorTypeCount();
List<Map<String,Object>>behaviorCount(); List<Map<String,Object>>behaviorCount();

2
yq-system/src/main/java/yq/system/service/impl/BehaviorDetectionServiceImpl.java

@ -43,7 +43,7 @@ public class BehaviorDetectionServiceImpl implements IBehaviorDetectionService {
} }
@Override @Override
public List<Map<String,Object>> behaviorTypeCount() { public Map<String,Object> behaviorTypeCount() {
return behaviorDetectionMapper.behaviorTypeCount(); return behaviorDetectionMapper.behaviorTypeCount();
} }

26
yq-system/src/main/resources/mapper/system/BehaviorDetectionMapper.xml

@ -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 &lt; 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 ,

Loading…
Cancel
Save