|
|
@@ -690,13 +690,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
wo.team_leader_name AS chargePerson,
|
|
|
<if test="repairPerson != null and repairPerson == 'true'">wop.nick_name AS repairPerson,ROUND(wop.score,2) AS score,</if>
|
|
|
<if test="repairPerson == null or repairPerson == '' or repairPerson == 'false'">ROUND(wo.score,2) AS score,</if>
|
|
|
- ROUND(TIMESTAMPDIFF( MINUTE, wo.create_time, wo.assign_time ) / 60,2) AS xfsc,
|
|
|
- ROUND(TIMESTAMPDIFF( MINUTE, wo.assign_time, wo.accept_time ) / 60,2) AS xysc,
|
|
|
- ROUND((TIMESTAMPDIFF( MINUTE, wo.accept_time, wo.real_start_time ) / 60) - (IFNULL(gq.total_before_start_suspend_seconds, 0) / 3600),2) AS zbsc,
|
|
|
- ROUND(TIMESTAMPDIFF( MINUTE, COALESCE ( wo.pause_time, wo.real_start_time ), wo.restart_time ) / 60,2) AS tjsc,
|
|
|
- ROUND(TIMESTAMPDIFF( MINUTE, wo.real_end_time, wo.restart_time ) / 60,2) AS qjbwsc,
|
|
|
- ROUND(( TIMESTAMPDIFF( MINUTE, wo.real_start_time, wo.real_end_time ) / 60 ) - (IFNULL(gq.total_in_work_suspend_seconds, 0) / 3600),2) AS clsc,
|
|
|
- ROUND(CASE WHEN gq.order_id IS NOT NULL THEN (gq.total_in_work_suspend_seconds)/3600 ELSE 0 END,2) AS gqsc
|
|
|
+ ROUND(TIMESTAMPDIFF( SECOND, wo.create_time, wo.assign_time ) / 3600,2) AS xfsc,
|
|
|
+ ROUND(TIMESTAMPDIFF( SECOND, wo.assign_time, wo.accept_time ) / 3600,2) AS xysc,
|
|
|
+ ROUND((TIMESTAMPDIFF( SECOND, wo.accept_time, wo.real_start_time ) - IFNULL(gq.total_before_start_suspend_seconds, 0)) / 3600,2) AS zbsc,
|
|
|
+ ROUND(TIMESTAMPDIFF( SECOND, COALESCE ( wo.pause_time, wo.real_start_time ), wo.restart_time ) / 3600,2) AS tjsc,
|
|
|
+ ROUND(TIMESTAMPDIFF( SECOND, wo.real_end_time, wo.restart_time ) / 3600,2) AS qjbwsc,
|
|
|
+ ROUND(( TIMESTAMPDIFF( SECOND, wo.real_start_time, wo.real_end_time ) - IFNULL(gq.total_in_work_suspend_seconds, 0)) / 3600,2) AS clsc,
|
|
|
+ ROUND(CASE WHEN gq.order_id IS NOT NULL THEN (gq.total_before_start_suspend_seconds + gq.total_in_work_suspend_seconds + gq.total_night_auto_suspend_seconds)/3600 ELSE 0 END,2) AS gqsc
|
|
|
FROM
|
|
|
gxt_work_order wo
|
|
|
<if test="repairPerson != null and repairPerson == 'true'">
|
|
|
@@ -704,9 +704,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</if>
|
|
|
LEFT JOIN gxt_work_order_flow_records_next gq ON gq.order_id = wo.id
|
|
|
LEFT JOIN (SELECT order_id,COUNT(*) AS wop_num FROM gxt_work_order_person GROUP BY order_id) wopp ON wopp.order_id=wo.id
|
|
|
+ LEFT JOIN (SELECT order_id,MAX(action_time) AS finish_time FROM gxt_work_order_flow WHERE action_type IN ('complete','auto_finalize') GROUP BY order_id) gsflow ON gsflow.order_id=wo.id
|
|
|
+ LEFT JOIN (SELECT order_id,MAX(action_time) AS score_time FROM gxt_work_order_flow WHERE action_type IN ('reviewRating','finalRating') GROUP BY order_id) gfflow ON gfflow.order_id=wo.id
|
|
|
<where>
|
|
|
- <if test="startTime != null "> AND wo.create_time > #{startTime}</if>
|
|
|
- <if test="endTime != null "> AND wo.create_time <![CDATA[<]]> #{endTime}</if>
|
|
|
+ <if test="startTime != null ">
|
|
|
+ <choose>
|
|
|
+ <when test="(xfsc != null and xfsc == 'true') or (xysc != null and xysc == 'true') or (zbsc != null and zbsc == 'true') or (tjsc != null and tjsc == 'true') or (qjbwsc != null and qjbwsc == 'true') or (clsc != null and clsc == 'true') or (gqsc != null and gqsc == 'true')">
|
|
|
+ AND gsflow.finish_time > #{startTime}
|
|
|
+ </when>
|
|
|
+ <when test="score != null and score == 1">
|
|
|
+ AND gfflow.score_time > #{startTime}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND wo.create_time > #{startTime}
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ <if test="endTime != null ">
|
|
|
+ <choose>
|
|
|
+ <when test="(xfsc != null and xfsc == 'true') or (xysc != null and xysc == 'true') or (zbsc != null and zbsc == 'true') or (tjsc != null and tjsc == 'true') or (qjbwsc != null and qjbwsc == 'true') or (clsc != null and clsc == 'true') or (gqsc != null and gqsc == 'true')">
|
|
|
+ AND gsflow.finish_time <![CDATA[<]]> #{endTime}
|
|
|
+ </when>
|
|
|
+ <when test="score != null and score == 1">
|
|
|
+ AND gfflow.score_time <![CDATA[<]]> #{endTime}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND wo.create_time <![CDATA[<]]> #{endTime}
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
<if test="pcsId != null "> AND wo.pcs_station_pid = #{pcsId}</if>
|
|
|
<if test="centerId != null "> AND wo.gxt_center_id = #{centerId}</if>
|
|
|
<if test="remark != null and remark != '' ">
|
|
|
@@ -726,7 +752,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</foreach>
|
|
|
</if>
|
|
|
<if test="dataPermission != null and dataPermission != ''">${dataPermission}</if>
|
|
|
- AND wopp.wop_num>0 AND wo.work_order_status IS NOT NULL AND wo.work_order_status IN ('completed','archived')
|
|
|
+ <choose>
|
|
|
+ <when test="score != null and score == 1">
|
|
|
+ AND wo.work_order_status IN ('archived')
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND wo.work_order_status IN ('completed','archived')
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ AND wopp.wop_num>0 AND wo.work_order_status IS NOT NULL
|
|
|
</where>
|
|
|
|
|
|
UNION ALL
|
|
|
@@ -745,12 +779,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
wo.team_leader_name AS chargePerson,
|
|
|
<if test="repairPerson != null and repairPerson == 'true'">wop.nick_name AS repairPerson,ROUND(wop.score,2) AS score,</if>
|
|
|
<if test="repairPerson == null or repairPerson == '' or repairPerson == 'false'">ROUND(wo.score,2) AS score,</if>
|
|
|
- ROUND(TIMESTAMPDIFF( MINUTE, wo.occur_time, wo.assign_time ) / 60,2) AS xfsc,
|
|
|
- ROUND((TIMESTAMPDIFF( MINUTE, wo.assign_time, wo.accept_time ) / 60)-(IFNULL(gq.total_night_auto_suspend_seconds, 0) / 3600),2) AS xysc,
|
|
|
- ROUND((TIMESTAMPDIFF( MINUTE, wo.accept_time, wo.real_start_time ) / 60)-(IFNULL(gq.total_before_start_suspend_seconds, 0) / 3600),2) AS zbsc,
|
|
|
- ROUND(TIMESTAMPDIFF( MINUTE, wo.occur_time, wo.restart_time ) / 60,2) AS tjsc,
|
|
|
- ROUND(TIMESTAMPDIFF( MINUTE, wo.real_end_time, wo.restart_time ) / 60,2) AS qjbwsc,
|
|
|
- ROUND((TIMESTAMPDIFF( MINUTE, wo.real_start_time, wo.real_end_time ) / 60 ) - (IFNULL(gq.total_before_start_suspend_seconds, 0) / 3600) - (IFNULL(gq.total_in_work_suspend_seconds, 0) / 3600),2) AS clsc,
|
|
|
+ ROUND(TIMESTAMPDIFF( SECOND, wo.occur_time, wo.assign_time ) / 3600,2) AS xfsc,
|
|
|
+ ROUND(( TIMESTAMPDIFF( SECOND, wo.assign_time, wo.accept_time ) - IFNULL(gq.total_night_auto_suspend_seconds, 0))/ 3600,2) AS xysc,
|
|
|
+ ROUND((TIMESTAMPDIFF( SECOND, wo.accept_time, wo.real_start_time ) - IFNULL(gq.total_before_start_suspend_seconds, 0)) / 3600,2) AS zbsc,
|
|
|
+ ROUND(TIMESTAMPDIFF( SECOND, wo.occur_time, wo.restart_time ) / 3600,2) AS tjsc,
|
|
|
+ ROUND(TIMESTAMPDIFF( SECOND, wo.real_end_time, wo.restart_time ) / 3600,2) AS qjbwsc,
|
|
|
+ ROUND((TIMESTAMPDIFF( SECOND, wo.real_start_time, wo.real_end_time ) - IFNULL(gq.total_in_work_suspend_seconds, 0)) / 3600,2) AS clsc,
|
|
|
ROUND(CASE WHEN gq.order_id IS NOT NULL THEN (gq.total_before_start_suspend_seconds + gq.total_in_work_suspend_seconds + gq.total_night_auto_suspend_seconds)/3600 ELSE 0 END,2) AS gqsc
|
|
|
FROM
|
|
|
gxt_repair_order wo
|
|
|
@@ -759,9 +793,35 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</if>
|
|
|
LEFT JOIN gxt_repair_order_flow_records_next gq ON gq.order_id = wo.id
|
|
|
LEFT JOIN (SELECT order_id,COUNT(*) AS wop_num FROM gxt_repair_order_person GROUP BY order_id) wopp ON wopp.order_id=wo.id
|
|
|
+ LEFT JOIN (SELECT order_id,MAX(action_time) AS finish_time FROM gxt_repair_order_flow WHERE action_type IN ('complete','auto_finalize') GROUP BY order_id) gsflow ON gsflow.order_id=wo.id
|
|
|
+ LEFT JOIN (SELECT order_id,MAX(action_time) AS score_time FROM gxt_repair_order_flow WHERE action_type IN ('reviewRating','finalRating') GROUP BY order_id) gfflow ON gfflow.order_id=wo.id
|
|
|
<where>
|
|
|
- <if test="startTime != null "> AND wo.occur_time > #{startTime}</if>
|
|
|
- <if test="endTime != null "> AND wo.occur_time <![CDATA[<]]> #{endTime}</if>
|
|
|
+ <if test="startTime != null ">
|
|
|
+ <choose>
|
|
|
+ <when test="(xfsc != null and xfsc == 'true') or (xysc != null and xysc == 'true') or (zbsc != null and zbsc == 'true') or (tjsc != null and tjsc == 'true') or (qjbwsc != null and qjbwsc == 'true') or (clsc != null and clsc == 'true') or (gqsc != null and gqsc == 'true')">
|
|
|
+ AND gsflow.finish_time > #{startTime}
|
|
|
+ </when>
|
|
|
+ <when test="score != null and score == 1">
|
|
|
+ AND gfflow.score_time > #{startTime}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND wo.occur_time > #{startTime}
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
+ <if test="endTime != null ">
|
|
|
+ <choose>
|
|
|
+ <when test="(xfsc != null and xfsc == 'true') or (xysc != null and xysc == 'true') or (zbsc != null and zbsc == 'true') or (tjsc != null and tjsc == 'true') or (qjbwsc != null and qjbwsc == 'true') or (clsc != null and clsc == 'true') or (gqsc != null and gqsc == 'true')">
|
|
|
+ AND gsflow.finish_time <![CDATA[<]]> #{endTime}
|
|
|
+ </when>
|
|
|
+ <when test="score != null and score == 1">
|
|
|
+ AND gfflow.score_time <![CDATA[<]]> #{endTime}
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND wo.occur_time <![CDATA[<]]> #{endTime}
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ </if>
|
|
|
<if test="pcsId != null "> AND wo.pcs_station_pid = #{pcsId}</if>
|
|
|
<if test="centerId != null "> AND wo.gxt_center_id = #{centerId}</if>
|
|
|
<if test="remark != null and remark != '' ">
|
|
|
@@ -781,7 +841,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
</foreach>
|
|
|
</if>
|
|
|
<if test="dataPermission != null and dataPermission != ''">${dataPermission}</if>
|
|
|
- AND wopp.wop_num>0 AND wo.work_order_status IS NOT NULL AND wo.work_order_status IN ('completed','archived')
|
|
|
+ <choose>
|
|
|
+ <when test="score != null and score == 1">
|
|
|
+ AND wo.work_order_status IN ('archived')
|
|
|
+ </when>
|
|
|
+ <otherwise>
|
|
|
+ AND wo.work_order_status IN ('completed','archived')
|
|
|
+ </otherwise>
|
|
|
+ </choose>
|
|
|
+ AND wopp.wop_num>0 AND wo.work_order_status IS NOT NULL
|
|
|
</where>
|
|
|
) o
|
|
|
<where>
|