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-common/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml |  405 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 405 insertions(+), 0 deletions(-)

diff --git a/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml b/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml
new file mode 100644
index 0000000..4e876b7
--- /dev/null
+++ b/lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml
@@ -0,0 +1,405 @@
+<?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.MdcEquipmentMapper">
+
+    <!--鏌ヨ璁惧鐨勬墍灞為儴闂ㄥ悕绉颁俊鎭�-->
+    <select id="getDepNamesByEquipmentIds" resultType="org.jeecg.modules.mdc.vo.MdcEquipmentDepVo">
+        SELECT d.depart_name, ed.equipment_id FROM mdc_equipment_depart ed, sys_depart d WHERE d.id = ed.dep_id AND ed.equipment_id IN
+        <foreach collection="equipmentIds" index="index" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </select>
+
+    <!--鏌ヨ璁惧鐨勬墍灞炰骇绾垮悕绉颁俊鎭�-->
+    <select id="getProNamesByEquipmentIds" resultType="org.jeecg.modules.mdc.vo.MdcEquipmentProVo">
+        SELECT p.production_name, pe.equipment_id FROM mdc_production_equipment pe, mdc_production p WHERE p.id = pe.production_id AND pe.equipment_id IN
+        <foreach collection="equipmentIds" index="index" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </select>
+
+    <!--鏍规嵁閮ㄩ棬id鏌ヨ璁惧鍒楄〃-->
+    <select id="pageListByDepId" resultType="org.jeecg.modules.mdc.entity.MdcEquipment">
+        SELECT
+            me.*
+        FROM
+            mdc_equipment_depart med,
+            mdc_equipment me
+        WHERE
+            med.equipment_id = me.id
+            AND med.dep_id = #{ departId }
+        <if test="equipmentId != null and equipmentId != '' ">
+            AND me.equipment_id = #{equipmentId}
+        </if>
+    </select>
+
+    <!--鏍规嵁浜х嚎id鏌ヨ璁惧鍒楄〃-->
+    <select id="pageListByProId" resultType="org.jeecg.modules.mdc.entity.MdcEquipment">
+        SELECT
+            me.*
+        FROM
+            mdc_production_equipment mpe,
+            mdc_equipment me
+        WHERE
+            mpe.equipment_id = me.id
+            AND mpe.production_id = #{ productionId }
+        <if test="equipmentId != null and equipmentId != '' ">
+            AND me.equipment_id = #{equipmentId}
+        </if>
+    </select>
+
+    <!--鏍规嵁閮ㄩ棬id鏌ヨ璁惧-->
+    <select id="queryByDepartId" resultType="org.jeecg.modules.mdc.entity.MdcEquipment">
+        SELECT
+            me.*
+        FROM
+            mdc_equipment_depart med,
+            mdc_equipment me
+        WHERE
+            med.equipment_id = me.id
+            AND med.dep_id = #{ departId }
+        ORDER BY me.equipment_id
+    </select>
+
+    <!--鏍规嵁浜х嚎id鏌ヨ璁惧-->
+    <select id="queryByProductionId" resultType="org.jeecg.modules.mdc.entity.MdcEquipment">
+        SELECT
+            me.*
+        FROM
+            mdc_production_equipment mpe,
+            mdc_equipment me
+        WHERE
+            mpe.equipment_id = me.id
+            AND mpe.production_id = #{ productionId }
+            AND me.device_type_mdc = '1'
+        ORDER BY me.equipment_id
+    </select>
+
+    <!--鏍规嵁浜х嚎id鏌ヨ璁惧id闆嗗悎-->
+    <select id="queryIdsByProductions" resultType="java.lang.String">
+        SELECT
+            me.equipment_id
+        FROM
+            mdc_equipment me
+            LEFT JOIN mdc_production_equipment mpe ON me.id = mpe.equipment_id
+        WHERE
+            mpe.production_id IN
+        <foreach collection="allProductionIds" index="index" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </select>
+
+    <!--鏍规嵁浜х嚎id鏌ヨ璁惧id闆嗗悎-->
+    <select id="getEquipmentList" resultType="org.jeecg.modules.mdc.entity.MdcEquipment">
+        SELECT
+        me.*
+        FROM
+        mdc_equipment me
+        LEFT JOIN mdc_production_equipment mpe ON me.id = mpe.equipment_id
+        WHERE
+        mpe.production_id IN
+        <foreach collection="allProductionIds" index="index" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </select>
+
+    <!--鏌ヨ璁惧鐩戞帶淇℃伅-->
+    <select id="checkStatusFromEquipmentIds" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentMonitor">
+        SELECT
+          t1.equipment_id,
+          t2.CollectTime,
+          t1.equipment_name,
+        CASE
+
+            WHEN repair.count > 0 THEN
+            '5' ELSE t2.Oporation
+          END AS Oporation,
+          t1.id,
+          t1.equipment_status,
+          t1.equipment_type equipmentType,
+          t1.equipment_image equipmentTypePictures
+
+        FROM
+          mdc_equipment t1
+          LEFT JOIN Equipment t2 ON t1.equipment_id = t2.EquipmentID
+          LEFT JOIN (
+            SELECT
+              e1.equipment_code,
+              COUNT(1) COUNT
+            FROM
+              eam_report_repair r1
+              INNER JOIN eam_equipment e1 ON e1.id = r1.equipment_id
+            WHERE
+              r1.report_status NOT IN ('COMPLETE', 'ABOLISH')
+          GROUP BY
+            e1.equipment_code) repair ON repair.equipment_code = t1.equipment_id
+        WHERE t1.equipment_id IN
+        <foreach collection="equipmentIds" index="index" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </select>
+
+    <!--鏍规嵁閮ㄩ棬id鏌ヨ璁惧id闆嗗悎-->
+    <select id="queryIdsByDeparts" resultType="java.lang.String">
+        SELECT
+            me.equipment_id
+        FROM
+            mdc_equipment me
+            LEFT JOIN mdc_equipment_depart med ON me.id = med.equipment_id
+        WHERE
+        med.dep_id IN
+        <foreach collection="allDepartIds" index="index" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </select>
+
+    <!--鏍规嵁璁惧缂栧彿鏌ヨ璁惧淇℃伅鍜岄儴闂ㄤ俊鎭�-->
+    <select id="findEquDepList" resultType="org.jeecg.modules.mdc.dto.MdcEquDepDto">
+        SELECT
+            sd.id,
+            sd.parent_id,
+            sd.depart_name,
+            sd.org_type,
+            me.equipment_id,
+            me.equipment_name,
+            me.equipment_type
+        FROM
+            mdc_equipment_depart med
+            LEFT JOIN sys_depart sd ON med.dep_id = sd.id
+            LEFT JOIN mdc_equipment me ON me.id = med.equipment_id
+        <where>
+            me.equipment_id IN
+            <foreach collection="equipmentIdList" index="index" item="id" open="(" separator="," close=")">
+                #{id}
+            </foreach>
+        </where>
+        ORDER BY sd.depart_order
+    </select>
+
+    <!--鏍规嵁璁惧缂栧彿鏌ヨ璁惧淇℃伅鍜屼骇绾夸俊鎭�-->
+    <select id="findEquProList" resultType="org.jeecg.modules.mdc.dto.MdcEquProDto">
+        SELECT
+            mp.id,
+            mp.parent_id,
+            mp.production_name,
+            mp.org_type,
+            me.equipment_id,
+            me.equipment_name,
+            me.equipment_type
+        FROM
+            mdc_production_equipment mpe
+            LEFT JOIN mdc_production mp ON mpe.production_id = mp.id
+            LEFT JOIN mdc_equipment me ON me.id = mpe.equipment_id
+        <where>
+            me.equipment_id IN
+            <foreach collection="equipmentIdList" index="index" item="id" open="(" separator="," close=")">
+                #{id}
+            </foreach>
+        </where>
+        ORDER BY mp.production_order
+    </select>
+
+    <!--鏍规嵁澶у睆杞﹂棿id鏌ヨ璁惧鍒楄〃-->
+    <select id="getEquipmentByWorkshopId" resultType="org.jeecg.modules.mdc.entity.MdcEquipment">
+        SELECT
+            me.*
+        FROM
+            mdc_workshop_equipment mwe
+            LEFT JOIN mdc_equipment me ON me.equipment_id = mwe.equipment_id
+        <where>
+            AND mwe.workshop_id = #{ workshopEquipmentVo.workshopId }
+            <if test="workshopEquipmentVo.equipmentId != null and workshopEquipmentVo.equipmentId != ''">
+                AND mwe.equipment_id = #{ workshopEquipmentVo.equipmentId }
+            </if>
+        </where>
+        ORDER BY me.equipment_id
+    </select>
+
+    <!--鍒嗛〉鍒楄〃-->
+    <select id="pageList" resultType="org.jeecg.modules.mdc.entity.MdcEquipment">
+        SELECT
+            t1.*
+        FROM
+            mdc_equipment t1
+            LEFT JOIN mdc_production_equipment t2 ON t1.id = t2.equipment_id
+            LEFT JOIN mdc_production t3 ON t2.production_id = t3.id
+        <where>
+            <if test="mdcEquipment.equipmentId != null and mdcEquipment.equipmentId != '' ">
+                AND t1.equipment_id LIKE CONCAT(CONCAT('%',#{mdcEquipment.equipmentId}),'%')
+            </if>
+            <if test="mdcEquipment.equipmentName != null and mdcEquipment.equipmentName != '' ">
+                AND t1.equipment_name LIKE CONCAT(CONCAT('%',#{mdcEquipment.equipmentName}),'%')
+            </if>
+            <if test="mdcEquipment.equipmentModel != null and mdcEquipment.equipmentModel != '' ">
+                AND t1.equipment_name = #{mdcEquipment.equipmentModel}
+            </if>
+            <if test="mdcEquipment.equipmentType != null and mdcEquipment.equipmentType != '' ">
+                AND t1.equipmentType = #{mdcEquipment.equipmentType}
+            </if>
+            <if test="mdcEquipment.driveType != null and mdcEquipment.driveType != '' ">
+                AND t1.drive_type = #{mdcEquipment.driveType}
+            </if>
+            <if test="mdcEquipment.deviceLevel != null and mdcEquipment.deviceLevel != '' ">
+                AND t1.device_level = #{mdcEquipment.deviceLevel}
+            </if>
+            <if test="mdcEquipment.deviceCategory != null and mdcEquipment.deviceCategory != '' ">
+                AND t1.device_category = #{mdcEquipment.deviceCategory}
+            </if>
+            <if test="mdcEquipment.productionIds != null and mdcEquipment.productionIds.size() > 0 ">
+                AND t3.id IN
+                <foreach collection="mdcEquipment.productionIds" index="index" item="id" open="(" separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
+        </where>
+        order by t1.sort_no
+    </select>
+
+    <select id="exportXlsList" resultType="org.jeecg.modules.mdc.entity.MdcEquipment">
+        SELECT
+            t1.*
+        FROM
+            mdc_equipment t1
+            LEFT JOIN mdc_production_equipment t2 ON t1.id = t2.equipment_id
+            LEFT JOIN mdc_production t3 ON t2.production_id = t3.id
+        <where>
+            <if test="mdcEquipment.equipmentId != null and mdcEquipment.equipmentId != '' ">
+                AND t1.equipment_id LIKE CONCAT(CONCAT('%',#{mdcEquipment.equipmentId}),'%')
+            </if>
+            <if test="mdcEquipment.equipmentName != null and mdcEquipment.equipmentName != '' ">
+                AND t1.equipment_name LIKE CONCAT(CONCAT('%',#{mdcEquipment.equipmentName}),'%')
+            </if>
+            <if test="mdcEquipment.equipmentModel != null and mdcEquipment.equipmentModel != '' ">
+                AND t1.equipment_name = #{mdcEquipment.equipmentModel}
+            </if>
+            <if test="mdcEquipment.equipmentType != null and mdcEquipment.equipmentType != '' ">
+                AND t1.equipment_type = #{mdcEquipment.equipmentType}
+            </if>
+            <if test="mdcEquipment.driveType != null and mdcEquipment.driveType != '' ">
+                AND t1.drive_type = #{mdcEquipment.driveType}
+            </if>
+            <if test="mdcEquipment.productionIds != null and mdcEquipment.productionIds.size() > 0 ">
+                AND t3.id IN
+                <foreach collection="mdcEquipment.productionIds" index="index" item="id" open="(" separator="," close=")">
+                    #{id}
+                </foreach>
+            </if>
+        </where>
+        order by t1.sort_no
+    </select>
+
+    <!--鏌ヨ鍗曡〃鏁版嵁-->
+    <select id="findWorkLineLast" resultType="org.jeecg.modules.mdc.dto.MdcEquipmentDto">
+        select top 1 spindlespeed, actualspindlespeed from [${tableName}] order by CollectTime  desc
+    </select>
+
+    <!--鏍规嵁id鑾峰彇璁惧淇℃伅-->
+    <select id="findById" resultType="org.jeecg.modules.mdc.dto.MdcEquipmentDetailedDto">
+        SELECT
+            t1.*,
+            t2.MaxAxis maxAxis,
+            t2.ValidAxis validAxis
+        FROM
+            mdc_equipment t1
+                LEFT JOIN EquipmentBaseInfo t2 ON t1.equipment_id = t2.EquipmentID
+        WHERE
+            t1.id = #{ id }
+    </select>
+
+    <select id="queryByProductionIdAndType" resultType="org.jeecg.modules.mdc.entity.MdcEquipment">
+        SELECT
+        me.*,
+        mpe.production_id
+        FROM
+        mdc_production_equipment mpe,
+        mdc_equipment me
+        WHERE
+        mpe.equipment_id = me.id
+        AND mpe.production_id = #{ productionId }
+        AND me.device_type_dnc = '1'
+        <if test="deviceIds != null and deviceIds.size() > 0">
+            AND me.id IN
+            <foreach collection = "deviceIds" item = "id" index = "index" open = "(" close= ")" separator = ",">
+                #{id}
+            </foreach>
+        </if>
+        ORDER BY me.equipment_id
+    </select>
+
+    <select id="findByProductionIds" resultType="org.jeecg.modules.mdc.entity.MdcEquipment">
+        SELECT
+            t1.*
+        FROM
+            mdc_equipment t1
+                LEFT JOIN mdc_production_equipment t2 ON t1.id = t2.equipment_id
+        WHERE t2.production_id IN
+        <foreach collection="mdcProductionIds" item = "productionId" index = "index" open = "(" close= ")" separator = ",">
+            #{productionId}
+        </foreach>
+    </select>
+
+    <select id="findByProIdsAndTeamCode" resultType="org.jeecg.modules.mdc.entity.MdcEquipment">
+        SELECT
+            t1.*
+        FROM
+            mdc_equipment t1
+                LEFT JOIN mdc_production_equipment t2 ON t1.id = t2.equipment_id
+        WHERE t2.production_id IN
+        <foreach collection="mdcProductionIds" item = "productionId" index = "index" open = "(" close= ")" separator = ",">
+            #{productionId}
+        </foreach>
+        AND t1.team_code IN
+        <foreach collection="teamCodeList" item = "teamCode" index = "index" open = "(" close= ")" separator = ",">
+            #{teamCode}
+        </foreach>
+    </select>
+
+    <select id="findByProIdsAndType" resultType="org.jeecg.modules.mdc.entity.MdcEquipment">
+        SELECT
+            t1.*
+        FROM
+            mdc_equipment t1
+                LEFT JOIN mdc_production_equipment t2 ON t1.id = t2.equipment_id
+        WHERE t2.production_id IN
+        <foreach collection="mdcProductionIds" item = "productionId" index = "index" open = "(" close= ")" separator = ",">
+            #{productionId}
+        </foreach>
+        AND t1.equipment_type IN
+        <foreach collection="typeList" item = "equipmentType" index = "index" open = "(" close= ")" separator = ",">
+            #{equipmentType}
+        </foreach>
+    </select>
+
+    <select id="queryByDepartIdsAndType" resultType="org.jeecg.modules.mdc.entity.MdcEquipment">
+        SELECT
+            e.*,
+        ep.production_id
+        FROM
+        mdc_equipment e
+        INNER JOIN mdc_production_equipment ep ON e.id = ep.equipment_id
+        WHERE
+        ep.production_id IN
+        <foreach collection='productionIds' item='id' open='(' separator=',' close=')'>
+            #{id}
+        </foreach>
+        AND e.id IN
+        <foreach collection='deviceIds' item='deviceId' open='(' separator=',' close=')'>
+            #{deviceId}
+        </foreach>
+    </select>
+
+    <select id="getEquIdsByProIds" resultType="java.lang.String">
+        SELECT
+        t1.equipment_id
+        FROM
+        mdc_equipment t1
+        LEFT JOIN mdc_production_equipment t2 ON t1.id = t2.equipment_id
+        <where>
+            t2.production_id IN
+            <foreach collection="proIds" index="index" item="id" open="(" separator="," close=")">
+                #{id}
+            </foreach>
+        </where>
+    </select>
+
+</mapper>

--
Gitblit v1.9.3