Przeglądaj źródła

驾驶舱个人工分统计

wanglt 2 tygodni temu
rodzic
commit
278f60c3df

+ 24 - 2
ygtx-gxt/src/main/resources/mapper/gxt/GxtWorkOrderMapper.xml

@@ -691,7 +691,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 wo.gxt_center AS center,
                 '维保工单' AS orderType,
                 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 and repairPerson == 'true'">wop.nick_name AS repairPerson,ROUND(osdd.score,2) AS score,</if>
                 <if test="repairPerson == null or repairPerson == '' or repairPerson == 'false'">ROUND(wo.score,2) AS score,</if>
                 NULL AS xfsc,
                 NULL AS xysc,
@@ -704,6 +704,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 gxt_work_order wo
                 <if test="repairPerson != null and repairPerson == 'true'">
                     LEFT JOIN gxt_work_order_person wop ON wo.id = wop.order_id
+                    LEFT JOIN (
+                    SELECT user_id,order_code,SUM(score) AS score FROM gxt_order_score_detail
+                    WHERE 1=1
+                    <if test="startTime != null ">
+                        AND create_time >= #{startTime}
+                    </if>
+                    <if test="endTime != null ">
+                        AND #{endTime} > create_time
+                    </if>
+                    GROUP BY user_id,order_code
+                    ) osdd ON wop.user_id=osdd.user_id AND osdd.order_code = wop.order_code
                 </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
@@ -782,7 +793,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 wo.gxt_center AS center,
                 '维修工单' AS orderType,
                 wo.team_leader_name AS chargePerson,
-                <if test="repairPerson != null and repairPerson == 'true'">IF(wo.repair_method='2', NULL, wop.nick_name) AS repairPerson,ROUND(wop.score,2) AS score,</if>
+                <if test="repairPerson != null and repairPerson == 'true'">IF(wo.repair_method='2', NULL, wop.nick_name) AS repairPerson,ROUND(osdd.score,2) AS score,</if>
                 <if test="repairPerson == null or repairPerson == '' or repairPerson == 'false'">ROUND(wo.score,2) AS score,</if>
                 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,
@@ -795,6 +806,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 gxt_repair_order wo
                 <if test="repairPerson != null and repairPerson == 'true'">
                     LEFT JOIN gxt_repair_order_person wop ON wo.id = wop.order_id
+                    LEFT JOIN (
+                        SELECT user_id,order_code,SUM(score) AS score FROM gxt_order_score_detail
+                        WHERE 1=1
+                            <if test="startTime != null ">
+                                AND create_time >= #{startTime}
+                            </if>
+                            <if test="endTime != null ">
+                                AND #{endTime} > create_time
+                            </if>
+                        GROUP BY user_id,order_code
+                    ) osdd ON wop.user_id=osdd.user_id AND osdd.order_code = wop.order_code
                 </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