From 9fa13f13bc33a95b53d03cfd2bfc1dad2beab905 Mon Sep 17 00:00:00 2001
From: qushaowei <qushaowei@163.com>
Date: 星期二, 16 四月 2024 09:42:24 +0800
Subject: [PATCH] 修改排序
---
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/CalibrationOrderMapper.xml | 70 ++++++++++++++++++++++++++++++++--
1 files changed, 65 insertions(+), 5 deletions(-)
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/CalibrationOrderMapper.xml b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/CalibrationOrderMapper.xml
index 06f679e..b0fea68 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/CalibrationOrderMapper.xml
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/CalibrationOrderMapper.xml
@@ -26,9 +26,21 @@
select TOP 1 org_type as orgType from mdc_production where production_code = #{productionCode}
</select>
+
+
<!--鑾峰彇褰撳墠鐧诲綍浜烘槸涓績鍙婂搴旂殑缂栫爜-->
<select id="findProductionCode" resultType="java.lang.String">
SELECT top 1 t2.production_code as productionCode FROM mdc_user_production t1 LEFT JOIN mdc_production t2 ON t1.pro_id = t2.id where t1.user_id =#{userId} and t2.org_type = '2'
+ </select>
+
+ <!--鑾峰彇褰撳墠鐧诲綍浜烘槸涓績鍙婂搴旂殑缂栫爜-->
+ <select id="findAreaProductionCode" resultType="java.lang.String">
+ SELECT top 1 t2.production_code as areaProductionCode FROM mdc_user_production t1 LEFT JOIN mdc_production t2 ON t1.pro_id = t2.id where t1.user_id =#{userId} and t2.org_type = '3'
+ </select>
+
+ <!--閫氳繃褰撳墠鐧诲綍浜虹殑宸ユ缂栫爜 鑾峰垎鍘傜紪鐮�-->
+ <select id="findSiteProductionCode" resultType="java.lang.String">
+ select fa.production_code as siteProductionCode from mdc_production son left join mdc_production fa on son.parent_id = fa.id where son.production_code =#{productionCode}
</select>
<select id="getFactoryEquipmentTechnologyStatusList" parameterType="String" resultType="Map">
@@ -58,8 +70,8 @@
</select>
<select id="getFactoryThisMonthMaintenanceFinishList" parameterType="String" resultType="Map">
- select count(0) as totalCount from mom_eam_daily_maintenance_order t1 left join mom_eam_equipment t2 on t1.equipment_id = t2.id
- where t1.del_flag = '0' and t1.status = '5' and SUBSTRING(CONVERT(VARCHAR(10), t1.actual_end_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 7)
+ select count(0) as totalCount from mom_eam_daily_maintenance_order t1 left join mom_eam_equipment t2 on t1.equipment_id = t2.id left join mom_eam_maintenance_cycle t4 on t1.maintenance_cycle_id = t4.id
+ where t1.del_flag = '0' and t1.status = '5' and t4.maintenance_type = '3' and SUBSTRING(CONVERT(VARCHAR(10), t1.actual_end_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 7)
</select>
<select id="getEquipmentTechnologyStatusList" parameterType="String" resultType="Map">
@@ -89,8 +101,29 @@
</select>
<select id="getThisMonthMaintenanceFinishList" parameterType="String" resultType="Map">
- select count(0) as totalCount from mom_eam_daily_maintenance_order t1 left join mom_eam_equipment t2 on t1.equipment_id = t2.id
- where t1.del_flag = '0' and t1.status = '5' and SUBSTRING(CONVERT(VARCHAR(10), t1.actual_end_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 7) <if test="workCenterId != null and workCenterId != ''"> and t2.work_center_id = #{workCenterId} </if> <if test="areaId != null and areaId != ''"> and t2.area_id = #{areaId} </if>
+ select count(0) as totalCount from mom_eam_daily_maintenance_order t1 left join mom_eam_equipment t2 on t1.equipment_id = t2.id left join mom_eam_maintenance_cycle t4 on t1.maintenance_cycle_id = t4.id
+ where t1.del_flag = '0' and t1.status = '5' and t4.maintenance_type = '3' and SUBSTRING(CONVERT(VARCHAR(10), t1.actual_end_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 7) <if test="workCenterId != null and workCenterId != ''"> and t2.work_center_id = #{workCenterId} </if> <if test="areaId != null and areaId != ''"> and t2.area_id = #{areaId} </if>
+ </select>
+
+ <select id="get3MaintenancePostponeCount" parameterType="String" resultType="Map">
+ select count(0) as totalCount from (select DISTINCT t2.id from mom_eam_plan_change_apply t1 left join mom_eam_equipment t2 on t1.equipment_id = t2.id
+ where SUBSTRING(CONVERT(VARCHAR(10), t2.next_third_maintenance_time, 120), 1, 7) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 7) and t2.area_id = #{areaId} ) t4
+ </select>
+
+ <select id="get3MaintenanceOverdueCount" parameterType="String" resultType="Map">
+ SELECT
+ count(0) as totalCount
+ FROM
+ mom_eam_daily_maintenance_order t1
+ LEFT JOIN mom_eam_equipment t2 ON t1.equipment_id = t2.id
+ left join mom_eam_maintenance_cycle t4 on t1.maintenance_cycle_id = t4.id
+ WHERE
+ t1.del_flag = '0'
+ and t1.status = '3'
+ and t4.maintenance_type = '3'
+ and SUBSTRING(CONVERT(VARCHAR(10), t1.plan_start_time, 120), 1, 10) < SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 10)
+ and SUBSTRING(CONVERT(VARCHAR(10), t2.next_third_maintenance_time, 120), 1, 10) = SUBSTRING(CONVERT(VARCHAR(10), GETDATE(), 120), 1, 10)
+ <if test="areaId != null and areaId != ''"> and t2.area_id = #{areaId} </if>
</select>
<select id="getCenterTwoMaintenancePlanList" parameterType="String" resultType="Map">
@@ -98,7 +131,7 @@
top 1
t1.id,
t5.name centerName,
- SUBSTRING(CONVERT(VARCHAR(10),t1.plan_start_time, 120), 1, 10) maintenanceDate,
+ SUBSTRING(CONVERT(VARCHAR(10),t1.plan_start_time, 120), 1, 7) maintenanceDate,
'浜岀骇淇濆吇' as content
FROM
mom_eam_equipment_maintenance_plan_detail t1
@@ -109,5 +142,32 @@
where t5.id = #{workCenterId} ORDER BY t1.plan_start_time desc
</select>
+ <select id="findMaintenanceDate" parameterType="String" resultType="java.lang.String">
+ SELECT
+ top 1
+ SUBSTRING(CONVERT(VARCHAR(10),t1.plan_start_time, 120), 1, 7) maintenanceDate
+ FROM
+ mom_eam_equipment_maintenance_plan_detail t1
+ left join mom_eam_maintenance_standard t3 on t1.standard_id = t3.id
+ left join mom_eam_equipment t4 on t3.equipment_id = t4.id
+ left join mom_base_area t5 on t4.work_center_id = t5.id
+ where t5.id = #{workCenterId} ORDER BY t1.plan_start_time desc
+ </select>
+
+ <!-- 宸ユ涓� 浜岀骇淇濆吇璁″垝鏄庣粏 -->
+ <select id="getAreTwoMaintenancePlanDetails" parameterType="String" resultType="Map">
+ SELECT
+ t1.id,
+ t4.num,
+ t4.name,
+ t4.model,
+ t4.specification
+ FROM
+ mom_eam_equipment_maintenance_plan_detail t1
+ LEFT JOIN mom_eam_maintenance_standard t3 ON t1.standard_id = t3.id
+ LEFT JOIN mom_eam_equipment t4 ON t3.equipment_id = t4.id
+ where t4.area_id = #{areaId} and SUBSTRING(CONVERT(VARCHAR(10), t1.plan_start_time, 120), 1, 7) = #{maintenanceDate}
+ </select>
+
</mapper>
\ No newline at end of file
--
Gitblit v1.9.3