From 2ca138ffb11b56690b03b61f00dd3e72f9f9076c Mon Sep 17 00:00:00 2001 From: wuweida <2918581207@qq.com> Date: Thu, 30 Jun 2022 11:32:33 +0800 Subject: [PATCH] =?UTF-8?q?=E9=81=93=E8=B7=AF=E6=B1=A1=E6=9F=93=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E6=8E=A5=E5=8F=A3=E6=B7=BB=E5=8A=A0=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E5=B9=B6=E6=8C=89=E6=97=B6=E9=97=B4=E5=80=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../monitormanage/controller/QidiController.java | 15 ++++++++++++--- .../monitormanage/mapper/RoadDataMapper.java | 6 ++++++ .../monitormanage/service/RoadDataService.java | 7 ------- src/main/resources/mapper/RoadDataMapper.xml | 5 +++++ 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/hisense/monitormanage/controller/QidiController.java b/src/main/java/com/hisense/monitormanage/controller/QidiController.java index d94117a..501eb30 100644 --- a/src/main/java/com/hisense/monitormanage/controller/QidiController.java +++ b/src/main/java/com/hisense/monitormanage/controller/QidiController.java @@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -50,6 +51,9 @@ public class QidiController { @Autowired private QidiService qidiService; + @Autowired + private RoadDataMapper roadDataMapper; + //道路统计数据与排名 @GetMapping("roadData") @ApiOperation("道路统计数据与排名,根据后台dt调用接口") @@ -293,9 +297,14 @@ public class QidiController { */ @GetMapping("selectRoadData") @ApiOperation("查询全部道路污染累计事件数量") - public Result selectRoadData(){ - List roadData = roadDataService.selectRoadData(); - Result success = Result.success(roadData); + public Result selectRoadData(Integer page,Integer pageSize){ + List roadData = roadDataMapper.selectRoadData(page,pageSize); + Integer integer = roadDataMapper.selectCountRoadData(); + page = integer/pageSize + 1; + Map map = new HashMap<>(); + map.put("page",page); + map.put("roadData",roadData); + Result success = Result.success(map); return success; } diff --git a/src/main/java/com/hisense/monitormanage/mapper/RoadDataMapper.java b/src/main/java/com/hisense/monitormanage/mapper/RoadDataMapper.java index 3351764..fe6e3f2 100644 --- a/src/main/java/com/hisense/monitormanage/mapper/RoadDataMapper.java +++ b/src/main/java/com/hisense/monitormanage/mapper/RoadDataMapper.java @@ -3,6 +3,7 @@ package com.hisense.monitormanage.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.hisense.monitormanage.entity.RoadData; import org.apache.ibatis.annotations.Param; +import org.apache.ibatis.annotations.Select; import java.util.List; import java.util.Map; @@ -16,4 +17,9 @@ import java.util.Map; */ public interface RoadDataMapper extends BaseMapper { public void batchSave(List list); + + List selectRoadData(@Param("page") Integer page,@Param("pageSize") Integer pageSize); + + @Select("select count(*) from t_road_data where pm10 > 150") + Integer selectCountRoadData(); } diff --git a/src/main/java/com/hisense/monitormanage/service/RoadDataService.java b/src/main/java/com/hisense/monitormanage/service/RoadDataService.java index cee7160..c747572 100644 --- a/src/main/java/com/hisense/monitormanage/service/RoadDataService.java +++ b/src/main/java/com/hisense/monitormanage/service/RoadDataService.java @@ -119,13 +119,6 @@ public class RoadDataService { return list; } - public List selectRoadData(){ - QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.gt("pm10",150); - List list = roadDataMapper.selectList(queryWrapper); - return list; - } - //获取当前日期的时间串,2022-05-08 00:00:00 private String dateTimeStr(){ LocalDate localDate = LocalDate.now(); diff --git a/src/main/resources/mapper/RoadDataMapper.xml b/src/main/resources/mapper/RoadDataMapper.xml index 23d6ca5..c95ab67 100644 --- a/src/main/resources/mapper/RoadDataMapper.xml +++ b/src/main/resources/mapper/RoadDataMapper.xml @@ -16,5 +16,10 @@ + \ No newline at end of file