From a660db06773007b1be690e0674829c00a57aeb7b Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期三, 24 十二月 2025 16:21:23 +0800
Subject: [PATCH] 订单首页流程卡新增楼层编号显示

---
 north-glass-erp/src/main/resources/mapper/pp/DeviceMaintenance.xml |  133 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 133 insertions(+), 0 deletions(-)

diff --git a/north-glass-erp/src/main/resources/mapper/pp/DeviceMaintenance.xml b/north-glass-erp/src/main/resources/mapper/pp/DeviceMaintenance.xml
new file mode 100644
index 0000000..9997a88
--- /dev/null
+++ b/north-glass-erp/src/main/resources/mapper/pp/DeviceMaintenance.xml
@@ -0,0 +1,133 @@
+<?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="com.example.erp.mapper.pp.DeviceMaintenanceMapper">
+    <resultMap id="DeviceMaintenanceMapper" type="com.example.erp.entity.pp.DeviceMaintenance">
+        <id column="id" property="id"/>
+        <result column="device_id" property="deviceId"/>
+        <result column="type" property="type"/>
+        <result column="fault_time" property="faultTime"/>
+        <result column="fault_reason" property="faultReason"/>
+        <result column="maintenance_time" property="maintenanceTime"/>
+        <result column="maintenance_illustrate" property="maintenanceIllustrate"/>
+        <result column="start_time" property="startTime"/>
+        <result column="stop_time" property="stopTime"/>
+        <result column="personnel" property="personnel"/>
+        <result column="cost" property="cost"/>
+
+
+    </resultMap>
+    <select id="getBasicData">
+        select id
+        from sd.basic_data
+        where basic_category = 'process'
+          and basic_name = #{process}
+    </select>
+
+<insert id="addMachineMp">
+    insert into pp.basic_data_produce(basic_type,basic_name,basic_category,create_time)
+    values('device',#{basicName},#{basicId},now())
+</insert>
+
+    <select id="selectProcessMp">
+        select * from sd.basic_data where basic_type='product' and basic_category='process'
+    </select>
+
+    <select id="selectDeviceMp">
+        SELECT
+            bdp.id,
+            bdp.basic_type,
+            bdp.basic_name,
+            bd.basic_name AS basic_category
+        FROM
+            sd.basic_data AS bd
+                LEFT JOIN `basic_data_produce` AS bdp ON bd.id = bdp.basic_category
+        WHERE
+            bd.basic_category = 'process'
+          AND bdp.basic_type = 'device'
+    </select>
+
+    <select id="getDeviceData">
+        select id
+        from basic_data_produce
+        where basic_type = 'device'
+          and basic_name = #{deviceName}
+    </select>
+
+    <insert id="saveMaintenanceAndRepairMp">
+        insert into device_maintenance(device_id,device_name,type,fault_time,fault_reason,maintenance_time,
+                                       maintenance_illustrate,start_time,stop_time,process,personnel,cost,create_time)
+        values (#{deviceId},#{deviceName},#{type},#{faultTime},#{faultReason},#{maintenanceTime},
+                #{maintenanceIllustrate},#{stopTime},#{startTime},#{process},#{personnel},#{cost},now())
+    </insert>
+
+    <select id="selectMaintenanceMp" resultMap="DeviceMaintenanceMapper">
+        select id,
+               device_id,
+               device_name,
+               type,
+               date(fault_time) as fault_time,
+               fault_reason,
+               date(maintenance_time) as maintenance_time,
+               maintenance_illustrate,
+               date(start_time) as start_time,
+               date(stop_time) as stop_time,
+               process,
+               personnel,
+               cost
+        from device_maintenance
+        where DATE_FORMAT((create_time), '%Y-%m-%d') BETWEEN #{ selectTime1 } AND #{ selectTime2 }
+    </select>
+
+    <delete id="deleteMaintenanceMp">
+        delete from device_maintenance where id = #{id}
+    </delete>
+
+    <select id="selectMachineMp">
+        select dm.device_id,dm.device_name,
+        if(dm.type=1,'缁翠慨','淇濆吇') as type,
+        (select count(*) from device_maintenance where id = dm.id and type = 1) as faultCount,
+        (select count(*) from device_maintenance where id = dm.id and type = 2) as maintenanceCount,
+        (select date(fault_time) from device_maintenance where id = dm.id and type = 1 order by fault_time desc limit 1) as faultLastTime,
+        (select date(maintenance_time) from device_maintenance where id = dm.id and type = 2 order by maintenance_time desc limit 1) as maintenanceLastTime,
+        (select sum(cost) from device_maintenance where id = dm.id and dm.type=1) as faultCost,
+        (select sum(cost) from device_maintenance where id = dm.id and dm.type=2) as maintenanceCost,
+        dm.process
+        from device_maintenance as dm
+        group by dm.device_id
+
+    </select>
+
+    <select id="openSelectIdMp">
+    select id,
+           device_id,
+           device_name,
+           type,
+           date(fault_time) as fault_time,
+           fault_reason,
+           date(maintenance_time) as maintenance_time,
+           maintenance_illustrate,
+           date(start_time) as start_time,
+           date(stop_time) as stop_time,
+           process,
+           personnel,
+           cost from device_maintenance where id = #{id}
+    </select>
+
+    <update id="updateMaintenanceMp">
+        update device_maintenance set
+        device_name = #{deviceName},
+        type = #{type},
+        fault_time = #{faultTime},
+        fault_reason = #{faultReason},
+        maintenance_time = #{maintenanceTime},
+        maintenance_illustrate = #{maintenanceIllustrate},
+        start_time = #{startTime},
+        stop_time = #{stopTime},
+        process = #{process},
+        personnel = #{personnel},
+        cost = #{cost}
+        where id = #{id}
+    </update>
+</mapper>
\ No newline at end of file

--
Gitblit v1.8.0