diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/OilAnalysisController.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/OilAnalysisController.java index c752cbd..8eb603c 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/OilAnalysisController.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/OilAnalysisController.java @@ -20,9 +20,9 @@ public class OilAnalysisController extends BaseController { private IOilThDeviceReportService oilThDeviceReportService; @GetMapping("/factoryBoundaryOnline") - public AjaxResult getDeviceReport(Long deptId, String beginDate, String endDate) { - List> alarmCount = oilThDeviceReportService.selectAlarmCountByDeptIdAndDateRange(deptId, beginDate, endDate); - List> alarmCountDesc = oilThDeviceReportService.selectAlarmCountByDeptIdAndDateRangeDesc(deptId, beginDate, endDate); + public AjaxResult getDeviceReport(Long deptId, String beginDate, String endDate, String deviceSn) { + List> alarmCount = oilThDeviceReportService.selectAlarmCountByDeptIdAndDateRange(deptId, beginDate, endDate, deviceSn); + List> alarmCountDesc = oilThDeviceReportService.selectAlarmCountByDeptIdAndDateRangeDesc(deptId, beginDate, endDate, deviceSn); Map resultMap = new HashMap<>(); resultMap.put("alarmCount", alarmCount); resultMap.put("alarmCountDesc", alarmCountDesc); diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/OilStatisticsController.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/OilStatisticsController.java index e3351a1..18602a4 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/OilStatisticsController.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/controller/OilStatisticsController.java @@ -43,6 +43,12 @@ public class OilStatisticsController extends BaseController { return getDataTable(devices); } + @GetMapping(value = "/getDeviceListByDeptId") + public TableDataInfo getDeviceListByDeptId(Long deptId) { + List devices = oilThDeviceService.selectDeviceListByDeptId(deptId); + return getDataTable(devices); + } + @GetMapping("/getDeviceReport") public TableDataInfo getDeviceReport(ThDeviceReport thDeviceReport) { if ("page".equals(thDeviceReport.getRemark())) { diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/ThDeviceReportMapper.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/ThDeviceReportMapper.java index d8c48ff..dd186b2 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/ThDeviceReportMapper.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/mapper/ThDeviceReportMapper.java @@ -76,10 +76,10 @@ public interface ThDeviceReportMapper { List> dailyReportDataOverview(@Param("day") String day); @MapKey("day") - List> selectAlarmCountByDeptIdAndDateRange(@Param("deptId") Long deptId, @Param("beginDate") String beginDate, @Param("endDate") String endDate); + List> selectAlarmCountByDeptIdAndDateRange(@Param("deptId") Long deptId, @Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("deviceSn") String deviceSn); @MapKey("sn") - List> selectAlarmCountByDeptIdAndDateRangeDesc(@Param("deptId") Long deptId, @Param("beginDate") String beginDate, @Param("endDate") String endDate); + List> selectAlarmCountByDeptIdAndDateRangeDesc(@Param("deptId") Long deptId, @Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("deviceSn") String deviceSn); @MapKey("sn") List> selectOverLimitCountByYearAndDeptId(@Param("deptId") Long deptId, @Param("year") String year); diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/IOilThDeviceReportService.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/IOilThDeviceReportService.java index 14a45e2..c181b47 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/IOilThDeviceReportService.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/IOilThDeviceReportService.java @@ -12,9 +12,9 @@ public interface IOilThDeviceReportService { List> dailyReportDataOverview(String day); - List> selectAlarmCountByDeptIdAndDateRange(Long deptId, String beginDate, String endDate); + List> selectAlarmCountByDeptIdAndDateRange(Long deptId, String beginDate, String endDate, String deviceSn); - List> selectAlarmCountByDeptIdAndDateRangeDesc(Long deptId, String beginDate, String endDate); + List> selectAlarmCountByDeptIdAndDateRangeDesc(Long deptId, String beginDate, String endDate, String deviceSn); List> selectOverLimitCountByYearAndDeptId(Long deptId, String year); diff --git a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/OilThDeviceReportService.java b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/OilThDeviceReportService.java index 528dcfe..cc70bc2 100644 --- a/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/OilThDeviceReportService.java +++ b/RuoYi-Vue-Oracle/src/main/java/com/ruoyi/project/oil/service/impl/OilThDeviceReportService.java @@ -37,13 +37,13 @@ public class OilThDeviceReportService implements IOilThDeviceReportService { } @Override - public List> selectAlarmCountByDeptIdAndDateRange(Long deptId, String beginDate, String endDate) { - return camelCaseMapListKey(thDeviceReportMapper.selectAlarmCountByDeptIdAndDateRange(deptId, beginDate, endDate)); + public List> selectAlarmCountByDeptIdAndDateRange(Long deptId, String beginDate, String endDate, String deviceSn) { + return camelCaseMapListKey(thDeviceReportMapper.selectAlarmCountByDeptIdAndDateRange(deptId, beginDate, endDate, deviceSn)); } @Override - public List> selectAlarmCountByDeptIdAndDateRangeDesc(Long deptId, String beginDate, String endDate) { - return camelCaseMapListKey(thDeviceReportMapper.selectAlarmCountByDeptIdAndDateRangeDesc(deptId, beginDate, endDate)); + public List> selectAlarmCountByDeptIdAndDateRangeDesc(Long deptId, String beginDate, String endDate, String deviceSn) { + return camelCaseMapListKey(thDeviceReportMapper.selectAlarmCountByDeptIdAndDateRangeDesc(deptId, beginDate, endDate, deviceSn)); } @Override diff --git a/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/ThDeviceReportMapper.xml b/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/ThDeviceReportMapper.xml index a987737..f64b94d 100644 --- a/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/ThDeviceReportMapper.xml +++ b/RuoYi-Vue-Oracle/src/main/resources/mybatis/oil/ThDeviceReportMapper.xml @@ -201,6 +201,9 @@ CONNECT BY PRIOR dept_id = parent_id)) AND TRUNC(d.REPORT_TIME) >= TO_DATE(#{beginDate}, 'YYYY-MM-DD') AND TRUNC(d.REPORT_TIME) <= TO_DATE(#{endDate}, 'YYYY-MM-DD') + + AND d.sn = #{deviceSn} + GROUP BY TO_CHAR(d.report_time, 'YYYY-MM-DD') ORDER BY day @@ -230,6 +233,9 @@ AND TRUNC(d.REPORT_TIME) >= TO_DATE(#{beginDate}, 'YYYY-MM-DD') AND TRUNC(d.REPORT_TIME) <= TO_DATE(#{endDate}, 'YYYY-MM-DD') AND (d.zt = '一级报警' OR d.zt = '二级报警') + + AND d.sn = #{deviceSn} + GROUP BY d.sn, p.dept_name, pp.dept_name, ppp.dept_name, td.address, td.name, d.zt ORDER BY count DESC diff --git a/ruoyi-ui/src/api/oil/device.js b/ruoyi-ui/src/api/oil/device.js index 45af4d5..b2e74c3 100644 --- a/ruoyi-ui/src/api/oil/device.js +++ b/ruoyi-ui/src/api/oil/device.js @@ -116,4 +116,13 @@ export function deviceBackAdd(data) { method: 'post', data: data }) -} \ No newline at end of file +} + +// 根据部门id查询设备列表 +export function getDeviceListByDeptId(query) { + return request({ + url: '/statistics/getDeviceListByDeptId', + method: 'get', + params: query + }) +} diff --git a/ruoyi-ui/src/components/DeviceSelect/index.vue b/ruoyi-ui/src/components/DeviceSelect/index.vue new file mode 100644 index 0000000..2f2695b --- /dev/null +++ b/ruoyi-ui/src/components/DeviceSelect/index.vue @@ -0,0 +1,96 @@ + + + + + diff --git a/ruoyi-ui/src/views/dataAnalysis/bound/index.vue b/ruoyi-ui/src/views/dataAnalysis/bound/index.vue index fc380de..36f3aaf 100644 --- a/ruoyi-ui/src/views/dataAnalysis/bound/index.vue +++ b/ruoyi-ui/src/views/dataAnalysis/bound/index.vue @@ -18,6 +18,14 @@ > + + +
@@ -37,6 +45,7 @@