This commit is contained in:
wuweida 2022-08-18 13:54:02 +08:00
parent 17c3663174
commit dc9a7b0099
4 changed files with 25 additions and 16 deletions

View File

@ -432,11 +432,12 @@ public class BuildingController {
@GetMapping("selectRoadDataCountEvent") @GetMapping("selectRoadDataCountEvent")
@ApiOperation("查询走航监测top5全部道路污染事件") @ApiOperation("查询走航监测top5全部道路污染事件")
public Result selectRoadDataCountEvent(){ public Result selectRoadDataCountEvent(){
List<RoadDataDto> roadDataDtos = buildingRecordsMapper.selectRoadDataCountEvent(); List<RoadDataDto> roadDataDtos = buildingRecordsMapper.selectRoadDataCountEvent();
Integer integer = roadDataMapper.selectCountRoadData();
Result success = Result.success(roadDataDtos); Map<String,Object> map = new HashMap<>();
map.put("sum",integer);
map.put("roadDataDtos",roadDataDtos);
Result success = Result.success(map);
return success; return success;
} }
@ -447,11 +448,12 @@ public class BuildingController {
@GetMapping("selectRoadDataWeekEvent") @GetMapping("selectRoadDataWeekEvent")
@ApiOperation("查询走航监测top5近7天道路污染事件") @ApiOperation("查询走航监测top5近7天道路污染事件")
public Result selectRoadDataWeekEvent(){ public Result selectRoadDataWeekEvent(){
List<RoadDataDto> roadDataDtos = buildingRecordsMapper.selectRoadDataWeekEvent(); List<RoadDataDto> roadDataDtos = buildingRecordsMapper.selectRoadDataWeekEvent();
Integer integer = roadDataMapper.selectCountWeekRoadData();
Result success = Result.success(roadDataDtos); Map<String,Object> map = new HashMap<>();
map.put("sum",integer);
map.put("roadDataDtos",roadDataDtos);
Result success = Result.success(map);
return success; return success;
} }
@ -462,11 +464,12 @@ public class BuildingController {
@GetMapping("selectRoadDataMonthEvent") @GetMapping("selectRoadDataMonthEvent")
@ApiOperation("查询走航监测top5近30天道路污染事件") @ApiOperation("查询走航监测top5近30天道路污染事件")
public Result selectRoadDataMonthEvent(){ public Result selectRoadDataMonthEvent(){
List<RoadDataDto> roadDataDtos = buildingRecordsMapper.selectRoadDataMonthEvent(); List<RoadDataDto> roadDataDtos = buildingRecordsMapper.selectRoadDataMonthEvent();
Integer integer = roadDataMapper.selectCountMonthRoadData();
Result success = Result.success(roadDataDtos); Map<String,Object> map = new HashMap<>();
map.put("sum",integer);
map.put("roadDataDtos",roadDataDtos);
Result success = Result.success(map);
return success; return success;
} }

View File

@ -91,13 +91,13 @@ public interface BuildingRecordsMapper extends BaseMapper<BuildingRecords> {
List<BuildingRecordsDtos> selectMonthCurrentByEvent(); List<BuildingRecordsDtos> selectMonthCurrentByEvent();
@Select("select rd.road_name,rd.`start`,rd.`end`,COUNT(*) number from t_road_data rd where pm10 > 150 GROUP BY rd.road_name,rd.`start`,rd.`end` ORDER BY number DESC limit 5") @Select("select rd.road_name,rd.`start`,rd.`end`,COUNT(*) number from t_road_data rd where pm10 > 150 GROUP BY rd.road_name,rd.`start`,rd.`end` ORDER BY number DESC")
List<RoadDataDto> selectRoadDataCountEvent(); List<RoadDataDto> selectRoadDataCountEvent();
@Select("select rd.road_name,rd.`start`,rd.`end`,COUNT(*) number from t_road_data rd where pm10 > 150 AND DATE_SUB(CURDATE(), INTERVAL 7 DAY) < DATE(rd.dt) GROUP BY rd.road_name,rd.`start`,rd.`end` ORDER BY number DESC limit 5") @Select("select rd.road_name,rd.`start`,rd.`end`,COUNT(*) number from t_road_data rd where pm10 > 150 AND DATE_SUB(CURDATE(), INTERVAL 7 DAY) < DATE(rd.dt) GROUP BY rd.road_name,rd.`start`,rd.`end` ORDER BY number DESC")
List<RoadDataDto> selectRoadDataWeekEvent(); List<RoadDataDto> selectRoadDataWeekEvent();
@Select("select rd.road_name,rd.`start`,rd.`end`,COUNT(*) number from t_road_data rd where pm10 > 150 AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) < DATE(rd.dt) GROUP BY rd.road_name,rd.`start`,rd.`end` ORDER BY number DESC limit 5") @Select("select rd.road_name,rd.`start`,rd.`end`,COUNT(*) number from t_road_data rd where pm10 > 150 AND DATE_SUB(CURDATE(), INTERVAL 30 DAY) < DATE(rd.dt) GROUP BY rd.road_name,rd.`start`,rd.`end` ORDER BY number DESC")
List<RoadDataDto> selectRoadDataMonthEvent(); List<RoadDataDto> selectRoadDataMonthEvent();
List<BuildingRecordsDtos> selectMonthCurrentByRoadData(); List<BuildingRecordsDtos> selectMonthCurrentByRoadData();

View File

@ -27,5 +27,11 @@ public interface RoadDataMapper extends BaseMapper<RoadData> {
@Select("select count(*) from t_road_data where pm10 > 150") @Select("select count(*) from t_road_data where pm10 > 150")
Integer selectCountRoadData(); Integer selectCountRoadData();
@Select("select count(*) from t_road_data where pm10 > 150 and DATE_SUB(CURDATE(), INTERVAL 7 DAY) < DATE(dt)")
Integer selectCountWeekRoadData();
@Select("select count(*) from t_road_data where pm10 > 150 and DATE_SUB(CURDATE(), INTERVAL 30 DAY) < DATE(dt)")
Integer selectCountMonthRoadData();
RoadData getByMaxId(); RoadData getByMaxId();
} }

View File

@ -57,7 +57,7 @@
<select id="selectByAllEvent" resultType="com.hisense.monitormanage.dto.EventDto"> <select id="selectByAllEvent" resultType="com.hisense.monitormanage.dto.EventDto">
SELECT * FROM t_event te SELECT * FROM t_event te
JOIN t_scene_event tse ON te.camera_name = tse.channel_name JOIN t_scene_event tse ON te.camera_name = tse.channel_name
WHERE te.track_event = 'START' WHERE te.track_event = 'START' AND tse.scene_id = 1
ORDER BY te.capture_time DESC ORDER BY te.capture_time DESC
<if test="page!=null and '' != page and pageSize != null and '' != pageSize"> <if test="page!=null and '' != page and pageSize != null and '' != pageSize">
<bind name="page" value="(page-1)*pageSize"/> <bind name="page" value="(page-1)*pageSize"/>