工程安全分析
This commit is contained in:
parent
25e86ef4d6
commit
3d07e2187d
|
|
@ -35,7 +35,7 @@ public class EngineeringSafetyAnalysisController extends BaseController {
|
|||
@ApiOperation(value = "查询安全隐患列表")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(EngineeringSafetyAnalysis environmentalReadings) {
|
||||
startPage();
|
||||
startLayPage();
|
||||
List<EngineeringSafetyAnalysis> list = environmentalReadingsService.selectEnvironmentalReadingsList(environmentalReadings);
|
||||
return getDataTableLayui(list);
|
||||
}
|
||||
|
|
@ -67,7 +67,7 @@ public class EngineeringSafetyAnalysisController extends BaseController {
|
|||
@ApiOperation(value = "查询环境监测趋势列表")
|
||||
@GetMapping("/getEnvironmentalList")
|
||||
public TableDataInfo getEnvironmentalList(EngineeringSafetyAnalysis environmentalReadings) {
|
||||
startPage();
|
||||
startLayPage();
|
||||
List<EngineeringSafetyAnalysis> list = environmentalReadingsService.getEnvironmentalList(environmentalReadings);
|
||||
return getDataTableLayui(list);
|
||||
}
|
||||
|
|
@ -78,7 +78,7 @@ public class EngineeringSafetyAnalysisController extends BaseController {
|
|||
@ApiOperation(value = "查询安全隐患分布列表")
|
||||
@GetMapping("/getHazardsList")
|
||||
public TableDataInfo getHazardsList(EngineeringSafetyAnalysis environmentalReadings) {
|
||||
startPage();
|
||||
startLayPage();
|
||||
List<EngineeringSafetyAnalysis> list = environmentalReadingsService.getHazardsList(environmentalReadings);
|
||||
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
|
||||
-- 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
|
||||
h.id AS id,
|
||||
h.type AS type,
|
||||
|
|
@ -34,10 +78,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
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,
|
||||
er.gas_value,
|
||||
er.wind_speed,
|
||||
er.humidity,
|
||||
er.temperature,
|
||||
pro.pro_name ,
|
||||
h.work_location,
|
||||
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
|
||||
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
|
||||
LEFT JOIN environmental_readings er on er.bid_id = h.environmental_readings_id
|
||||
WHERE
|
||||
(#{bidCode} IS NULL OR #{bidCode} = '' OR h.bid_code = #{bidCode})
|
||||
<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
|
||||
date,
|
||||
AVG(temperature) AS temperature,
|
||||
AVG(humidity) AS humidity,
|
||||
AVG(wind_speed) AS wind_speed,
|
||||
AVG(gas_value) AS gas_value
|
||||
temperature ,
|
||||
humidity ,
|
||||
wind_speed ,
|
||||
gas_value
|
||||
FROM
|
||||
environmental_readings
|
||||
WHERE
|
||||
bid_code = #{bidCode}
|
||||
GROUP BY
|
||||
date
|
||||
ORDER BY
|
||||
date ASC
|
||||
</select>
|
||||
|
|
@ -109,7 +128,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</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
|
||||
FROM environmental_readings
|
||||
WHERE bid_code = #{bidCode}
|
||||
|
|
@ -119,7 +138,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
ORDER BY date ASC
|
||||
</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
|
||||
FROM hazards
|
||||
WHERE bid_code = #{bidCode}
|
||||
|
|
|
|||
Loading…
Reference in New Issue