| | |
| | | </insert> |
| | | <insert id="insertBatch"> |
| | | INSERT INTO oth_statistic_workload |
| | | (statistic_date,user_id |
| | | (id,statistic_date,user_id |
| | | ,user_name,type,node_content |
| | | ,number) |
| | | WITH total as (select |
| | |
| | | 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) |
| | | 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 |
| | | select null AS id, 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) |
| | | select null AS id, 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 ='') |
| | | select null AS id, 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; |
| | | </insert> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.dy.pmsGlobal.pojoOth.OthStatisticWorkload"> |