From e3cc5fb859a4e3c56c1dfa4d7892b233a30874fa Mon Sep 17 00:00:00 2001
From: 廖井涛 <2265517004@qq.com>
Date: 星期五, 12 四月 2024 15:32:33 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override

---
 north-glass-erp/src/main/resources/mapper/pp/DeviceMaintenance.xml |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 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
index bce9660..741cc4c 100644
--- a/north-glass-erp/src/main/resources/mapper/pp/DeviceMaintenance.xml
+++ b/north-glass-erp/src/main/resources/mapper/pp/DeviceMaintenance.xml
@@ -63,10 +63,29 @@
     </insert>
 
     <select id="selectMaintenanceMp" resultMap="DeviceMaintenanceMapper">
-        select * from device_maintenance
+        select * 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 * from device_maintenance where id = #{id}
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0