Merge remote-tracking branch 'origin/main'

This commit is contained in:
sxu 2025-07-24 20:00:41 +08:00
commit a5d41afb51
6 changed files with 62 additions and 63 deletions

View File

@ -25,4 +25,5 @@ public class ProjectQualityVo {
// 不合格率 // 不合格率
private String noPassRate; private String noPassRate;
private String unqualifiedItems; private String unqualifiedItems;
private String checkItems;
} }

View File

@ -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);
} }

View File

@ -39,6 +39,7 @@
</select> </select>
<select id="getEngqualityAnalysis" resultType="com.securitycontrol.entity.screen.vo.ProjectQualityVo"> <select id="getEngqualityAnalysis" resultType="com.securitycontrol.entity.screen.vo.ProjectQualityVo">
select tpq.project_name as projectName, select tpq.project_name as projectName,
tpq.check_items as checkItems,
tpq.project_manager as projectManager, tpq.project_manager as projectManager,
tpq.team, tpq.team,
tpq.start_time as startTime, tpq.start_time as startTime,

View File

@ -19,7 +19,8 @@
<select id="selectDeviceEnergyByDateRange" resultType="com.securitycontrol.screen.domain.DeviceEnergyAnalysis"> <select id="selectDeviceEnergyByDateRange" resultType="com.securitycontrol.screen.domain.DeviceEnergyAnalysis">
SELECT device_name AS deviceName, SELECT device_name AS deviceName,
SUM(consumption_kwh) AS consumptionKwh SUM(consumption_kwh) AS consumptionKwh,
SUM(renewable_used_kwh * 0.997) AS renewableUsedKwh
FROM device_energy_analysis FROM device_energy_analysis
WHERE stat_date BETWEEN #{startDate} AND #{endDate} WHERE stat_date BETWEEN #{startDate} AND #{endDate}
and pro_id = #{proId} and pro_id = #{proId}
@ -53,26 +54,4 @@
</select> </select>
<select id="selectLatestAll" resultType="com.securitycontrol.screen.domain.EnergySavingMeasure">
SELECT esm.id AS id,
esm.measure_name AS measureName,
esm.coverage_rate AS coverageRate,
esm.stat_date AS statDate
FROM energy_saving_measures esm
INNER JOIN (SELECT measure_name,
MAX(stat_date) AS max_date,
pro_id
FROM energy_saving_measures
WHERE pro_id = #{proId}
GROUP BY measure_name, pro_id) t ON esm.measure_name = t.measure_name
AND esm.stat_date = t.max_date
AND esm.pro_id = t.pro_id
WHERE esm.pro_id = #{proId}
ORDER BY esm.coverage_rate DESC
</select>
</mapper> </mapper>

View File

@ -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}

View File

@ -45,7 +45,6 @@
<if test="resourceType != null and resourceType != ''"> <if test="resourceType != null and resourceType != ''">
AND ri.type = #{resourceType} AND ri.type = #{resourceType}
</if> </if>
AND ru.record_time = ( AND ru.record_time = (
SELECT MAX(record_time) SELECT MAX(record_time)
FROM resource_utilization FROM resource_utilization