From 9376436cdd6e3986cc4af4b4a6aa9e78e2b32de0 Mon Sep 17 00:00:00 2001 From: zmc <zmc_li@foxmail.com> Date: 星期一, 14 八月 2023 17:09:42 +0800 Subject: [PATCH] 油烟监测系统 SprintBoot代码 --- src/main/resources/com/job/zsc/mapper/Vue3FumeMapper.xml | 44 +++++++++++++++++++++++++++++++++++++------- 1 files changed, 37 insertions(+), 7 deletions(-) diff --git a/src/main/resources/com/job/zsc/mapper/Vue3FumeMapper.xml b/src/main/resources/com/job/zsc/mapper/Vue3FumeMapper.xml index d6b9270..c3abbaf 100644 --- a/src/main/resources/com/job/zsc/mapper/Vue3FumeMapper.xml +++ b/src/main/resources/com/job/zsc/mapper/Vue3FumeMapper.xml @@ -26,23 +26,53 @@ </select> <!-- 鍘嗗彶娌圭儫鏌ヨ--> +<!-- <select id="conditionQueryHistory" resultType="com.job.zsc.pojo.FumeHistoryData">--> +<!-- select a1.MV_ID,a1.MV_Stat_Code,b.DI_Name,a1.MV_Data_Time,a1.MV_Fume_Concentration2,a1.MV_Fan_Electricity,a1.MV_Purifier_Electricity--> +<!-- from fd_t_minutevalue as a1 , ea_t_device_info as b--> +<!-- <where>--> +<!-- <!– 鏉′欢涓虹┖鏃舵煡璇㈠叏閮�–>--> +<!-- <if test="(devId ==null or devId == '') or (beginTime ==null and endTime == null)">--> +<!-- a1.MV_Stat_Code = b.DI_Code--> +<!-- </if>--> +<!-- <if test="devId != null and devId != '' ">--> +<!-- and a1.MV_Stat_Code = #{devId} and b.DI_Code = #{devId}--> +<!-- </if>--> + +<!-- <if test="beginTime != null and endTime != null">--> +<!-- and a1.MV_Data_Time between #{beginTime} and #{endTime}--> +<!-- </if>--> +<!-- </where>--> +<!-- order by MV_Data_Time asc--> +<!-- </select>--> + <!-- 鍘嗗彶娌圭儫鏌ヨ--> <select id="conditionQueryHistory" resultType="com.job.zsc.pojo.FumeHistoryData"> - select a1.MV_ID,a1.MV_Stat_Code,b.DI_Name,a1.MV_Data_Time,a1.MV_Fume_Concentration2,a1.MV_Fan_Electricity,a1.MV_Purifier_Electricity - from fd_t_minutevalue as a1 , ea_t_device_info as b + SELECT d.DI_Name, c.* + FROM ( + SELECT a.* + FROM fd_t_minutevalue as a + LEFT JOIN fd_t_minutevalue as b ON a.MV_Data_Time = b.MV_Data_Time AND a.MV_Isduplication < b.MV_Isduplication + WHERE b.MV_ID IS NULL AND a.MV_Stat_Code = #{devId}) + as c,ea_t_device_info as d + +<!-- CREATE TEMPORARY TABLE IF NOT EXISTS temp_table AS--> +<!-- SELECT a.*--> +<!-- FROM fd_t_minutevalue AS a--> +<!-- LEFT JOIN fd_t_minutevalue AS b ON a.MV_Data_Time = b.MV_Data_Time AND a.MV_Isduplication < b.MV_Isduplication WHERE b.MV_ID IS NULL AND a.MV_Stat_Code = 'GLHB00000000016004'--> + <where> <!-- 鏉′欢涓虹┖鏃舵煡璇㈠叏閮�--> <if test="(devId ==null or devId == '') or (beginTime ==null and endTime == null)"> - a1.MV_Stat_Code = b.DI_Code + c.MV_Stat_Code = d.DI_Code </if> <if test="devId != null and devId != '' "> - and a1.MV_Stat_Code = #{devId} and b.DI_Code = #{devId} + and c.MV_Stat_Code = #{devId} and d.DI_Code = #{devId} </if> <if test="beginTime != null and endTime != null"> - and a1.MV_Data_Time between #{beginTime} and #{endTime} + AND c.MV_Data_Time between #{beginTime} AND #{endTime} </if> </where> - order by MV_Data_Time asc + ORDER BY c.MV_Data_Time ASC; </select> <!-- 鏉′欢鏌ヨ寮傚父琛�--> @@ -109,7 +139,7 @@ <!-- 澶氶�夊簵閾哄悕 杩斿洖澶氶�夊簵閾烘渶鏂颁竴鏉℃暟鎹�--> <select id="findLaststById" resultType="com.job.zsc.pojo.FumeHistoryData"> - SELECT a.MV_Stat_Code, b.DI_Name, a.MV_Data_Time,a.MV_Fan_Electricity,a.MV_Purifier_Electricity,a.MV_Fume_Concentration2 + SELECT a.MV_Stat_Code, b.DI_Name, b.DI_Supplier, a.MV_Data_Time,a.MV_Fan_Electricity,a.MV_Purifier_Electricity,a.MV_Fume_Concentration2 FROM fd_t_minutevalue as a JOIN ea_t_device_info as b ON a.MV_Stat_Code = b.DI_Code JOIN ( -- Gitblit v1.9.3