工程安全分析
This commit is contained in:
parent
25e86ef4d6
commit
3d07e2187d
|
|
@ -35,7 +35,7 @@ public class EngineeringSafetyAnalysisController extends BaseController {
|
||||||
@ApiOperation(value = "查询安全隐患列表")
|
@ApiOperation(value = "查询安全隐患列表")
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(EngineeringSafetyAnalysis environmentalReadings) {
|
public TableDataInfo list(EngineeringSafetyAnalysis environmentalReadings) {
|
||||||
startPage();
|
startLayPage();
|
||||||
List<EngineeringSafetyAnalysis> list = environmentalReadingsService.selectEnvironmentalReadingsList(environmentalReadings);
|
List<EngineeringSafetyAnalysis> list = environmentalReadingsService.selectEnvironmentalReadingsList(environmentalReadings);
|
||||||
return getDataTableLayui(list);
|
return getDataTableLayui(list);
|
||||||
}
|
}
|
||||||
|
|
@ -67,7 +67,7 @@ public class EngineeringSafetyAnalysisController extends BaseController {
|
||||||
@ApiOperation(value = "查询环境监测趋势列表")
|
@ApiOperation(value = "查询环境监测趋势列表")
|
||||||
@GetMapping("/getEnvironmentalList")
|
@GetMapping("/getEnvironmentalList")
|
||||||
public TableDataInfo getEnvironmentalList(EngineeringSafetyAnalysis environmentalReadings) {
|
public TableDataInfo getEnvironmentalList(EngineeringSafetyAnalysis environmentalReadings) {
|
||||||
startPage();
|
startLayPage();
|
||||||
List<EngineeringSafetyAnalysis> list = environmentalReadingsService.getEnvironmentalList(environmentalReadings);
|
List<EngineeringSafetyAnalysis> list = environmentalReadingsService.getEnvironmentalList(environmentalReadings);
|
||||||
return getDataTableLayui(list);
|
return getDataTableLayui(list);
|
||||||
}
|
}
|
||||||
|
|
@ -78,7 +78,7 @@ public class EngineeringSafetyAnalysisController extends BaseController {
|
||||||
@ApiOperation(value = "查询安全隐患分布列表")
|
@ApiOperation(value = "查询安全隐患分布列表")
|
||||||
@GetMapping("/getHazardsList")
|
@GetMapping("/getHazardsList")
|
||||||
public TableDataInfo getHazardsList(EngineeringSafetyAnalysis environmentalReadings) {
|
public TableDataInfo getHazardsList(EngineeringSafetyAnalysis environmentalReadings) {
|
||||||
startPage();
|
startLayPage();
|
||||||
List<EngineeringSafetyAnalysis> list = environmentalReadingsService.getHazardsList(environmentalReadings);
|
List<EngineeringSafetyAnalysis> list = environmentalReadingsService.getHazardsList(environmentalReadings);
|
||||||
return getDataTableLayui(list);
|
return getDataTableLayui(list);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,50 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
<!--查询安全隐患集合列表-->
|
<!--查询安全隐患集合列表-->
|
||||||
<select id="selectEnvironmentalReadingsList" parameterType="com.securitycontrol.screen.domain.EngineeringSafetyAnalysis" resultMap="EngineeringSafetyAnalysisResult">
|
<select id="selectEnvironmentalReadingsList" parameterType="com.securitycontrol.screen.domain.EngineeringSafetyAnalysis" resultMap="EngineeringSafetyAnalysisResult">
|
||||||
|
-- SELECT
|
||||||
|
-- h.id AS id,
|
||||||
|
-- h.type AS type,
|
||||||
|
-- h.level AS level,
|
||||||
|
-- h.timestamp AS timestamp,
|
||||||
|
-- h.bid_code,
|
||||||
|
-- mp.id AS monitoring_point_id ,
|
||||||
|
-- mp.name AS name,
|
||||||
|
-- COALESCE(ale.avg_temperature, '-') AS temperature,
|
||||||
|
-- COALESCE(ale.avg_humidity, '-') AS humidity,
|
||||||
|
-- COALESCE(ale.avg_wind_speed, '-') AS wind_speed,
|
||||||
|
-- COALESCE(ale.avg_gas_value, '-') AS gas_value,
|
||||||
|
-- pro.pro_name ,
|
||||||
|
-- h.work_location,
|
||||||
|
-- h.analysis_reason
|
||||||
|
-- FROM
|
||||||
|
-- hazards h
|
||||||
|
-- LEFT JOIN tb_project_new pro on h.bid_code = pro.bid_code
|
||||||
|
-- LEFT JOIN
|
||||||
|
-- monitoring_points mp ON h.monitoring_point_id = mp.id
|
||||||
|
-- LEFT JOIN
|
||||||
|
-- (
|
||||||
|
-- -- 子查询:获取每个 bid_code 最新日期的环境数据平均值
|
||||||
|
-- SELECT
|
||||||
|
-- er.bid_code,
|
||||||
|
-- AVG(er.temperature) AS avg_temperature,
|
||||||
|
-- AVG(er.humidity) AS avg_humidity,
|
||||||
|
-- AVG(er.wind_speed) AS avg_wind_speed,
|
||||||
|
-- AVG(er.gas_value) AS avg_gas_value
|
||||||
|
-- FROM
|
||||||
|
-- environmental_readings er
|
||||||
|
-- JOIN (
|
||||||
|
-- -- 找到每个 bid_code 的最新日期
|
||||||
|
-- SELECT
|
||||||
|
-- bid_code,
|
||||||
|
-- MAX(date) AS max_date
|
||||||
|
-- FROM
|
||||||
|
-- environmental_readings
|
||||||
|
-- GROUP BY
|
||||||
|
-- bid_code
|
||||||
|
-- ) AS latest_dates ON er.bid_code = latest_dates.bid_code AND er.date = latest_dates.max_date
|
||||||
|
-- GROUP BY
|
||||||
|
-- er.bid_code
|
||||||
|
-- ) ale ON h.bid_code = ale.bid_code
|
||||||
SELECT
|
SELECT
|
||||||
h.id AS id,
|
h.id AS id,
|
||||||
h.type AS type,
|
h.type AS type,
|
||||||
|
|
@ -34,10 +78,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
h.bid_code,
|
h.bid_code,
|
||||||
mp.id AS monitoring_point_id ,
|
mp.id AS monitoring_point_id ,
|
||||||
mp.name AS name,
|
mp.name AS name,
|
||||||
COALESCE(ale.avg_temperature, '-') AS temperature,
|
er.gas_value,
|
||||||
COALESCE(ale.avg_humidity, '-') AS humidity,
|
er.wind_speed,
|
||||||
COALESCE(ale.avg_wind_speed, '-') AS wind_speed,
|
er.humidity,
|
||||||
COALESCE(ale.avg_gas_value, '-') AS gas_value,
|
er.temperature,
|
||||||
pro.pro_name ,
|
pro.pro_name ,
|
||||||
h.work_location,
|
h.work_location,
|
||||||
h.analysis_reason
|
h.analysis_reason
|
||||||
|
|
@ -46,30 +90,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
LEFT JOIN tb_project_new pro on h.bid_code = pro.bid_code
|
LEFT JOIN tb_project_new pro on h.bid_code = pro.bid_code
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
monitoring_points mp ON h.monitoring_point_id = mp.id
|
monitoring_points mp ON h.monitoring_point_id = mp.id
|
||||||
LEFT JOIN
|
LEFT JOIN environmental_readings er on er.bid_id = h.environmental_readings_id
|
||||||
(
|
|
||||||
-- 子查询:获取每个 bid_code 最新日期的环境数据平均值
|
|
||||||
SELECT
|
|
||||||
er.bid_code,
|
|
||||||
AVG(er.temperature) AS avg_temperature,
|
|
||||||
AVG(er.humidity) AS avg_humidity,
|
|
||||||
AVG(er.wind_speed) AS avg_wind_speed,
|
|
||||||
AVG(er.gas_value) AS avg_gas_value
|
|
||||||
FROM
|
|
||||||
environmental_readings er
|
|
||||||
JOIN (
|
|
||||||
-- 找到每个 bid_code 的最新日期
|
|
||||||
SELECT
|
|
||||||
bid_code,
|
|
||||||
MAX(date) AS max_date
|
|
||||||
FROM
|
|
||||||
environmental_readings
|
|
||||||
GROUP BY
|
|
||||||
bid_code
|
|
||||||
) AS latest_dates ON er.bid_code = latest_dates.bid_code AND er.date = latest_dates.max_date
|
|
||||||
GROUP BY
|
|
||||||
er.bid_code
|
|
||||||
) ale ON h.bid_code = ale.bid_code
|
|
||||||
WHERE
|
WHERE
|
||||||
(#{bidCode} IS NULL OR #{bidCode} = '' OR h.bid_code = #{bidCode})
|
(#{bidCode} IS NULL OR #{bidCode} = '' OR h.bid_code = #{bidCode})
|
||||||
<if test="name != null and name != ''">
|
<if test="name != null and name != ''">
|
||||||
|
|
@ -82,16 +103,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
<select id="environmentalList" parameterType="com.securitycontrol.screen.domain.EngineeringSafetyAnalysis" resultMap="EngineeringSafetyAnalysisResult">
|
<select id="environmentalList" parameterType="com.securitycontrol.screen.domain.EngineeringSafetyAnalysis" resultMap="EngineeringSafetyAnalysisResult">
|
||||||
SELECT
|
SELECT
|
||||||
date,
|
date,
|
||||||
AVG(temperature) AS temperature,
|
temperature ,
|
||||||
AVG(humidity) AS humidity,
|
humidity ,
|
||||||
AVG(wind_speed) AS wind_speed,
|
wind_speed ,
|
||||||
AVG(gas_value) AS gas_value
|
gas_value
|
||||||
FROM
|
FROM
|
||||||
environmental_readings
|
environmental_readings
|
||||||
WHERE
|
WHERE
|
||||||
bid_code = #{bidCode}
|
bid_code = #{bidCode}
|
||||||
GROUP BY
|
|
||||||
date
|
|
||||||
ORDER BY
|
ORDER BY
|
||||||
date ASC
|
date ASC
|
||||||
</select>
|
</select>
|
||||||
|
|
@ -109,7 +128,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
<select id="getEnvironmentalList" resultType="com.securitycontrol.screen.domain.EngineeringSafetyAnalysis">
|
<select id="getEnvironmentalList" parameterType="com.securitycontrol.screen.domain.EngineeringSafetyAnalysis" resultMap="EngineeringSafetyAnalysisResult">
|
||||||
SELECT id,date,temperature,humidity,wind_speed,gas_value
|
SELECT id,date,temperature,humidity,wind_speed,gas_value
|
||||||
FROM environmental_readings
|
FROM environmental_readings
|
||||||
WHERE bid_code = #{bidCode}
|
WHERE bid_code = #{bidCode}
|
||||||
|
|
@ -119,7 +138,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
ORDER BY date ASC
|
ORDER BY date ASC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getHazardsList" resultType="com.securitycontrol.screen.domain.EngineeringSafetyAnalysis">
|
<select id="getHazardsList" parameterType="com.securitycontrol.screen.domain.EngineeringSafetyAnalysis" resultMap="EngineeringSafetyAnalysisResult">
|
||||||
SELECT id,type,level,timestamp
|
SELECT id,type,level,timestamp
|
||||||
FROM hazards
|
FROM hazards
|
||||||
WHERE bid_code = #{bidCode}
|
WHERE bid_code = #{bidCode}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue