From 8000dd179e5a1eef3113cbd75dddb32bbb805d1c Mon Sep 17 00:00:00 2001
From: Fancy <Fancy.fx@outlook.com>
Date: 星期二, 07 一月 2025 11:58:12 +0800
Subject: [PATCH] edit
---
pms-parent/pms-global/src/main/resources/mapper/OthStatisticWorkloadMapper.xml | 27 ++++++++++++++++++++++-----
1 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/pms-parent/pms-global/src/main/resources/mapper/OthStatisticWorkloadMapper.xml b/pms-parent/pms-global/src/main/resources/mapper/OthStatisticWorkloadMapper.xml
index 42d0ad4..314b3d2 100644
--- a/pms-parent/pms-global/src/main/resources/mapper/OthStatisticWorkloadMapper.xml
+++ b/pms-parent/pms-global/src/main/resources/mapper/OthStatisticWorkloadMapper.xml
@@ -77,21 +77,38 @@
WITH total as (select
DISTINCT(t.device_no) device_no,t.curr_node,t.node_content,t.number,p.pro_name, p.plan_name,u.id user_id,u.`name` user_name
FROM
- (select * from sta_device_production_log_past
- where repair_id IS NULL and out_time BETWEEN #{startDt} AND #{endDt}
+ (select DISTINCT device_no,plan_id,station_id,curr_node,node_content,number,updated_by from sta_device_production_log_past
+ <!-- repair_id IS NULL and -->
+ where out_time BETWEEN #{startDt} AND #{endDt}
union
- select * from sta_device_production_log
- where repair_id IS NULL and out_time BETWEEN #{startDt} AND #{endDt}
+ select DISTINCT device_no,plan_id,station_id,curr_node,node_content,number,updated_by from sta_device_production_log
+ where out_time BETWEEN #{startDt} AND #{endDt}
) t
left join (select pap.id,pap.`name` as plan_name,pp.`name` as pro_name
from pr_assembly_plan pap, plt_product pp where pap.pro_id = pp.id) p on t.plan_id = p.id
- left JOIN ba_user u on u.id=t.updated_by)
+ left JOIN ba_user u on u.id=t.updated_by),
+ WITH assistants_total as (select t.device_no,t.curr_node,t.node_content,t.number,p.pro_name, p.plan_name,u.id user_id,u.`name` user_name
+ FROM
+ ( SELECT a.*,SUBSTRING_INDEX( SUBSTRING_INDEX( a.assistants, ',', b.help_topic_id + 1 ), ',', - 1 ) AS assistant FROM
+ (select DISTINCT device_no,plan_id,station_id,curr_node,node_content,number,updated_by,assistants from sta_device_production_log_past
+ where assistants IS NOT NULL AND out_time BETWEEN #{startDt} AND #{endDt}
+ union
+ select DISTINCT device_no,plan_id,station_id,curr_node,node_content,number,updated_by,assistants from sta_device_production_log
+ where assistants IS NOT NULL AND out_time BETWEEN #{startDt} AND #{endDt}) a
+ JOIN mysql.help_topic AS b ON b.help_topic_id <![CDATA[ < ]]> ( LENGTH( a.assistants ) - LENGTH( REPLACE ( a.assistants, ',', '' ) ) + 1 )
+ ) t
+ left join (select pap.id,pap.`name` as plan_name,pp.`name` as pro_name
+ from pr_assembly_plan pap, plt_product pp where pap.pro_id = pp.id) p on t.plan_id = p.id
+ left JOIN ba_user u on u.id=t.assistant)
select DATE_FORMAT(#{startDt}, '%Y-%m-%d') as statistic_date,user_id, user_name,'璁″垝浠诲姟' AS type, node_content ,sum(number) as number from total where curr_node IS NOT NULL GROUP BY user_id,user_name,node_content
UNION
select DATE_FORMAT(#{startDt}, '%Y-%m-%d') as statistic_date, user_id, user_name,'涓存椂浠诲姟' AS type, node_content, sum(number) as number from total where curr_node IS NULL AND (device_no !='' AND device_no IS NOT NULL)
GROUP BY user_id,user_name,node_content
UNION
select DATE_FORMAT(#{startDt}, '%Y-%m-%d') as statistic_date,user_id , user_name,'涓存椂浠诲姟(鏃犺澶囩爜)' AS type,node_content, sum(number) as number from total where curr_node IS NULL AND (device_no IS NULL OR device_no ='')
+ GROUP BY user_id,user_name,node_content
+ UNION
+ select DATE_FORMAT(#{startDt}, '%Y-%m-%d') as statistic_date,user_id , user_name,'杈呭姪宸ヤ綔' AS type,node_content, sum(number) as number from assistants_total
GROUP BY user_id,user_name,node_content;
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.dy.pmsGlobal.pojoOth.OthStatisticWorkload">
--
Gitblit v1.8.0