From 23855599412c4d61b38d78f0f3abd3430a48b5b1 Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期三, 25 六月 2025 11:51:38 +0800
Subject: [PATCH] Merge branch 'mdc_hyjs_master'

---
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentRunningSectionMapper.xml |  215 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 215 insertions(+), 0 deletions(-)

diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentRunningSectionMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentRunningSectionMapper.xml
new file mode 100644
index 0000000..964540d
--- /dev/null
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentRunningSectionMapper.xml
@@ -0,0 +1,215 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.mdc.mapper.MdcEquipmentRunningSectionMapper">
+
+    <!--鏌ヨ鍗曞彴璁惧鏈�鍚庢椂闂存璁板綍锛堥潪鎶ヨ锛�-->
+    <select id="getMaxNormal" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection">
+        SELECT TOP 1 * FROM mdc_equipment_running_section WHERE equipment_id = #{equipmentId} AND status <![CDATA[ <> ]]> '22' ORDER BY end_time DESC
+    </select>
+
+    <!--鑾峰彇璁$畻娈垫椂闂村悗鐨勬渶鍚庝竴鏉¤褰曪紙鎶ヨ锛�-->
+    <select id="getMaxError" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection">
+        SELECT TOP 1 * FROM mdc_equipment_running_section WHERE equipment_id = #{equipmentId} AND status = '22' ORDER BY end_time DESC
+    </select>
+
+    <!--鑾峰彇璁惧杩愯璁板綍鏈�鏃╃殑鏁版嵁-->
+    <select id="getFirstData" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection">
+        SELECT TOP 1 * FROM mdc_equipment_running_section WHERE equipment_id = #{equipmentId} ORDER BY start_time
+    </select>
+
+    <!--鏌ヨ璁惧鍗曟棩杩愯鐘舵�佹椂闂存璁板綍-->
+    <select id="listForEquipmentStatisticalInfo" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection">
+        SELECT
+            *
+        FROM
+            mdc_equipment_running_section
+        WHERE
+            equipment_id = #{ equipmentId }
+            AND  (start_time &lt;= #{ endDate } AND end_time &gt;= #{ startDate })
+        ORDER BY
+            start_time
+    </select>
+
+    <!--璁$畻涓�娈垫椂闂村唴鐨勬暟鎹�-->
+    <select id="listEquipmentRunningSection" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection">
+        SELECT
+            *
+        FROM
+            mdc_equipment_running_section
+        WHERE
+            equipment_id = #{ equipmentId }
+            AND  (start_long &lt;= #{ endLong } AND end_long &gt;= #{ startLong })
+        ORDER BY
+            start_time
+    </select>
+
+    <!--璁$畻涓�娈垫椂闂村唴鐨勮繍琛屾暟鎹�-->
+    <select id="listEquipmentRunningSectionRun" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection">
+        SELECT
+            *
+        FROM
+            mdc_equipment_running_section
+        WHERE
+            equipment_id = #{ equipmentId }
+            AND status <![CDATA[ <> ]]> '22'
+            AND  (start_long &lt;= #{ endLong } AND end_long &gt;= #{ startLong })
+        ORDER BY
+            start_time
+    </select>
+
+    <!--璁$畻涓�娈垫椂闂村唴鐨勬晠闅滄暟鎹�-->
+    <select id="listEquipmentRunningSectionError" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection">
+        SELECT
+            *
+        FROM
+            mdc_equipment_running_section
+        WHERE
+            equipment_id = #{ equipmentId }
+            AND status = '22'
+            AND  (start_long &lt;= #{ endLong } AND end_long &gt;= #{ startLong })
+        ORDER BY
+            start_time
+    </select>
+
+    <!--鏌ヨ涓�娈垫椂闂村唴鐨勬姤璀︽暟鎹�-->
+    <select id="findAlarmList" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection">
+        SELECT
+            *
+        FROM
+            mdc_equipment_running_section
+        <where>
+            <if test="vo.equipmentIdList != null and vo.equipmentIdList.size() > 0 ">
+                AND equipment_id IN
+                <foreach collection="vo.equipmentIdList" item="id" index="index" open="(" close=")" separator=",">
+                    #{ id }
+                </foreach>
+            </if>
+            AND (start_time &lt;= #{ vo.endDate } AND end_time &gt;= #{ vo.startDate })
+            AND status = '22'
+            AND alarm != ''
+        </where>
+        ORDER BY
+            start_time
+    </select>
+
+    <!--鏌ヨ鏁伴噺-->
+    <select id="findAlarmCount" resultType="java.lang.Integer">
+        SELECT
+            COUNT(*)
+        FROM
+            mdc_equipment_running_section
+        <where>
+            AND status = '22'
+            AND alarm = #{ alarmCode }
+            AND (start_time &lt;= #{ endDate } AND end_time &gt;= #{ startDate })
+            AND equipment_id = #{ equipmentId }
+        </where>
+    </select>
+
+    <!--鏍规嵁鏃ユ湡鏌ヨ鏁伴噺-->
+    <select id="findAlarmCountByDate" resultType="java.lang.Integer">
+        SELECT
+            COUNT(*)
+        FROM
+            mdc_equipment_running_section
+        <where>
+            AND status = '22'
+            AND alarm = #{ vo.alarmCode }
+            AND (start_time &lt;= #{ endDate } AND end_time &gt;= #{ startDate })
+            <if test="vo.equipmentIdList != null and vo.equipmentIdList.size() > 0 ">
+                AND equipment_id IN
+                <foreach collection="vo.equipmentIdList" item="id" index="index" open="(" close=")" separator=",">
+                    #{ id }
+                </foreach>
+            </if>
+        </where>
+    </select>
+
+    <!--鏌ヨ鏃堕棿娈靛唴杩愯鏁版嵁-->
+    <select id="selectRunningData" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection">
+        SELECT
+            *
+        FROM
+            mdc_equipment_running_section
+        WHERE
+            equipment_id = #{ equipmentId }
+          AND status = '3'
+          AND  (start_time &lt;= #{ endDate } AND end_time &gt;= #{ startDate })
+        ORDER BY
+            start_time
+    </select>
+
+    <!--鏌ヨ鎶ヨ鍙锋姤璀﹁缁嗕俊鎭�-->
+    <select id="selectAlarmList" resultType="org.jeecg.modules.mdc.dto.MdcAlarmListDto">
+        SELECT
+            t1.equipment_id,
+            t2.equipment_name,
+            t1.start_time,
+            t1.end_time,
+            t1.duration
+        FROM
+            mdc_equipment_running_section t1 LEFT JOIN mdc_equipment t2 ON t1.equipment_id = t2.equipment_id
+        <where>
+            AND t1.status = '22'
+            AND t1.alarm = #{ vo.alarmCode }
+            AND (t1.start_time &lt;= #{ endDate } AND t1.end_time &gt;= #{ startDate })
+            <if test="vo.equipmentIdList != null and vo.equipmentIdList.size() > 0 ">
+                AND t1.equipment_id IN
+                <foreach collection="vo.equipmentIdList" item="id" index="index" open="(" close=")" separator=",">
+                    #{ id }
+                </foreach>
+            </if>
+        </where>
+    </select>
+
+    <select id="getDataList" resultType="java.lang.Integer">
+        SELECT
+            status
+        FROM
+            mdc_equipment_running_section
+        WHERE
+            equipment_id = #{ equipmentId }
+          AND start_time &gt; #{date}
+          AND status IS NOT NULL
+    </select>
+
+    <select id="findWaitList" resultType="org.jeecg.modules.mdc.dto.MdcEquipmentWaitSectionDto">
+        SELECT
+            t1.*,
+            t2.equipment_name
+        FROM
+            mdc_equipment_running_section t1
+                LEFT JOIN mdc_equipment t2 ON t1.equipment_id = t2.equipment_id
+        WHERE
+            duration > 1200
+          AND status = 2
+          AND CONVERT ( VARCHAR, start_time, 120 ) LIKE CONCAT(#{date},'%')
+        ORDER BY
+            equipment_id, start_time DESC
+    </select>
+
+    <select id="findFaultList" resultType="org.jeecg.modules.mdc.vo.EquFaultRecord">
+        SELECT
+            t3.equipment_code equipmentId,
+            t1.fault_start_time startTime,
+            t2.actual_end_time endTime
+        FROM
+            eam_report_repair t1
+                LEFT JOIN eam_repair_order t2 ON t2.report_id = t1.id
+                LEFT JOIN eam_equipment t3 ON t1.equipment_id = t3.id
+        WHERE
+            (
+                ( t1.fault_start_time BETWEEN #{startTime} AND #{endTime} )
+                OR ( t2.actual_end_time BETWEEN #{startTime} AND #{endTime} )
+                OR ( t1.fault_start_time &lt; #{startTime} AND t2.actual_end_time IS NULL )
+            )
+          AND t3.equipment_code = #{equipmentId}
+          AND t1.report_status != 'ABOLISH'
+    </select>
+
+    <select id="getFirstRecord" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentRunningSection">
+        SELECT TOP 1 * FROM mdc_equipment_running_section ORDER BY start_time
+    </select>
+
+
+</mapper>
\ No newline at end of file

--
Gitblit v1.9.3