|
|
@@ -114,12 +114,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
(SELECT COUNT(*)
|
|
|
FROM gxt_repair_order_flow f2
|
|
|
WHERE f2.order_id = f.order_id
|
|
|
- AND f2.action_type IN ('approved', 'resume')
|
|
|
+ AND f2.action_type IN ('approved', 'resume', 'auto_suspend', 'auto_resume')
|
|
|
AND f.action_time >= f2.action_time) AS order_seq
|
|
|
FROM gxt_repair_order_flow f
|
|
|
LEFT JOIN gxt_repair_order ro
|
|
|
ON ro.id = f.order_id
|
|
|
- WHERE f.action_type IN ('approved', 'resume')
|
|
|
+ WHERE f.action_type IN ('approved', 'resume', 'auto_suspend', 'auto_resume')
|
|
|
) t
|
|
|
</select>
|
|
|
|
|
|
@@ -139,12 +139,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
(SELECT COUNT(*)
|
|
|
FROM gxt_repair_order_flow f2
|
|
|
WHERE f2.order_id = f.order_id
|
|
|
- AND f2.action_type IN ('approved', 'resume')
|
|
|
+ AND f2.action_type IN ('approved', 'resume', 'auto_suspend', 'auto_resume')
|
|
|
AND f.action_time >= f2.action_time) AS order_seq
|
|
|
FROM gxt_repair_order_flow f
|
|
|
LEFT JOIN gxt_repair_order ro
|
|
|
ON ro.id = f.order_id
|
|
|
- WHERE f.action_type IN ('approved', 'resume')
|
|
|
+ WHERE f.action_type IN ('approved', 'resume', 'auto_suspend', 'auto_resume')
|
|
|
ORDER BY f.order_id, f.action_time
|
|
|
</insert>
|
|
|
|
|
|
@@ -153,11 +153,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
order_id,
|
|
|
total_before_start_suspend_seconds,
|
|
|
total_in_work_suspend_seconds,
|
|
|
+ total_night_auto_suspend_seconds,
|
|
|
before_start_suspend_format,
|
|
|
- in_work_suspend_format
|
|
|
+ in_work_suspend_format,
|
|
|
+ night_auto_suspend_format
|
|
|
)
|
|
|
SELECT
|
|
|
- t1.order_id,
|
|
|
+ t0.order_id,
|
|
|
COALESCE(SUM(CASE
|
|
|
WHEN t1.action_time <![CDATA[<]]> t1.real_start_time
|
|
|
THEN TIMESTAMPDIFF(SECOND, t1.action_time, t2.action_time)
|
|
|
@@ -169,6 +171,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
THEN TIMESTAMPDIFF(SECOND, t1.action_time, t2.action_time)
|
|
|
ELSE 0
|
|
|
END), 0) AS total_in_work_suspend_seconds,
|
|
|
+ COALESCE(SUM(CASE
|
|
|
+ WHEN t4.action_time IS NOT NULL
|
|
|
+ THEN TIMESTAMPDIFF(SECOND, t3.action_time, t4.action_time)
|
|
|
+ ELSE 0
|
|
|
+ END), 0) AS total_night_auto_suspend_seconds,
|
|
|
|
|
|
CONCAT(
|
|
|
FLOOR(COALESCE(SUM(CASE
|
|
|
@@ -204,15 +211,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
THEN TIMESTAMPDIFF(SECOND, t1.action_time, t2.action_time)
|
|
|
ELSE 0
|
|
|
END), 0), 60), '秒'
|
|
|
- ) AS in_work_suspend_format
|
|
|
- FROM gxt_repair_order_flow_records t1
|
|
|
+ ) AS in_work_suspend_format,
|
|
|
+
|
|
|
+ CONCAT(
|
|
|
+ FLOOR(COALESCE(SUM(CASE
|
|
|
+ WHEN t4.action_time IS NOT NULL
|
|
|
+ THEN TIMESTAMPDIFF(SECOND, t3.action_time, t4.action_time)
|
|
|
+ ELSE 0
|
|
|
+ END), 0) / 3600), '小时',
|
|
|
+ FLOOR(MOD(COALESCE(SUM(CASE
|
|
|
+ WHEN t4.action_time IS NOT NULL
|
|
|
+ THEN TIMESTAMPDIFF(SECOND, t3.action_time, t4.action_time)
|
|
|
+ ELSE 0
|
|
|
+ END), 0), 3600) / 60), '分钟',
|
|
|
+ MOD(COALESCE(SUM(CASE
|
|
|
+ WHEN t4.action_time IS NOT NULL
|
|
|
+ THEN TIMESTAMPDIFF(SECOND, t3.action_time, t4.action_time)
|
|
|
+ ELSE 0
|
|
|
+ END), 0), 60), '秒'
|
|
|
+ ) AS night_auto_suspend_format
|
|
|
+
|
|
|
+ FROM (SELECT order_id FROM gxt_repair_order_flow_records GROUP BY order_id) t0
|
|
|
+ LEFT JOIN gxt_repair_order_flow_records t1
|
|
|
+ ON t0.order_id = t1.order_id
|
|
|
+ AND t1.action_type = 'approved'
|
|
|
LEFT JOIN gxt_repair_order_flow_records t2
|
|
|
ON t1.order_id = t2.order_id
|
|
|
AND t2.order_seq = t1.order_seq + 1
|
|
|
AND t1.action_type = 'approved'
|
|
|
- AND t2.action_type = 'resume'
|
|
|
- GROUP BY t1.order_id
|
|
|
- ORDER BY t1.order_id
|
|
|
+ AND t2.action_type IN ('resume','auto_resume')
|
|
|
+ LEFT JOIN gxt_repair_order_flow_records t3
|
|
|
+ ON t0.order_id = t3.order_id
|
|
|
+ AND t3.action_type = 'auto_suspend'
|
|
|
+ LEFT JOIN gxt_repair_order_flow_records t4
|
|
|
+ ON t3.order_id = t4.order_id
|
|
|
+ AND t4.order_seq = t3.order_seq + 1
|
|
|
+ AND t3.action_type = 'auto_suspend'
|
|
|
+ AND t4.action_type IN ('resume','auto_resume')
|
|
|
+ GROUP BY t0.order_id
|
|
|
+ ORDER BY t0.order_id
|
|
|
</insert>
|
|
|
|
|
|
<select id="selectWorkOrderFlowRecordsSize" resultType="Integer">
|