select id, plan_code,plan_code_w, power_outage_devices, per_hour_households_m, per_hour_households_w, SUBSTRING_INDEX(city, '国网湖南省电力有限公司', -1)city, SUBSTRING_INDEX(SUBSTRING_INDEX(county, '国网湖南省电力有限公司', -1),'国网衡阳供电公司',-1)county, SUBSTRING_INDEX(station, '国网湖南省电力有限公司', -1)station, line_code, line_name, per_hour_households_artif,SUBSTRING_INDEX(declar_agency, '国网衡阳供电公司', -1) declar_agency, is_maintenance, is_approve, maintenance_file_path,maintenance_file_name, approve_file_path,approve_file_name, create_by, create_time, update_by, update_time,std_org_no,week_start_dt,week_end_dt,std_county_org_no from ads_cst_hygszdbb_pdmmaintenanceprocess_wf select (select ROUND(sum(hour_num),2) from ads_cst_hygszdbb_pdmstoprecords_df r where SUBSTRING_INDEX(REPLACE(r.line_nm,' ',''),'10kV',-1)=SUBSTRING_INDEX(REPLACE(p.line_name,' ',''),'10kV',-1) and poweroff_nature_cd in('2111','2112','2121','2122','2141','2211','2212','2221','2231','2241') and DATE_FORMAT(poweroff_start_tm, '%Y-%m-%d') >= week_start_dt and DATE_FORMAT(poweroff_term_tm, '%Y-%m-%d') <= week_end_dt)hour_num,id, plan_code,plan_code_w, power_outage_devices, per_hour_households_m, per_hour_households_w, SUBSTRING_INDEX(city, '国网湖南省电力有限公司', -1)city, SUBSTRING_INDEX(SUBSTRING_INDEX(county, '国网湖南省电力有限公司', -1),'国网衡阳供电公司',-1)county, SUBSTRING_INDEX(station, '国网湖南省电力有限公司', -1)station, line_code, line_name, per_hour_households_artif,SUBSTRING_INDEX(declar_agency, '国网衡阳供电公司', -1) declar_agency, is_maintenance, is_approve, maintenance_file_path,maintenance_file_name, approve_file_path,approve_file_name, create_by, create_time, update_by, update_time,std_org_no,week_start_dt,week_end_dt,std_county_org_no from ads_cst_hygszdbb_pdmmaintenanceprocess_wf p insert into ads_cst_hygszdbb_pdmmaintenanceprocess_wf plan_code, power_outage_devices, per_hour_households_m, per_hour_households_w, city, county, station, line_code, line_name, per_hour_households_artif, declar_agency, is_maintenance, is_approve, maintenance_file_path, approve_file_path, create_by, create_time, update_by, update_time, #{planCode}, #{powerOutageDevices}, #{perHourHouseholdsM}, #{perHourHouseholdsW}, #{city}, #{county}, #{station}, #{lineCode}, #{lineName}, #{perHourHouseholdsArtif}, #{declarAgency}, #{isMaintenance}, #{isApprove}, #{maintenanceFilePath}, #{approveFilePath}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime}, update ads_cst_hygszdbb_pdmmaintenanceprocess_wf plan_code = #{planCode}, power_outage_devices = #{powerOutageDevices}, per_hour_households_m = #{perHourHouseholdsM}, per_hour_households_w = #{perHourHouseholdsW}, city = #{city}, county = #{county}, station = #{station}, line_code = #{lineCode}, line_name = #{lineName}, per_hour_households_artif = #{perHourHouseholdsArtif}, declar_agency = #{declarAgency}, is_maintenance = #{isMaintenance}, is_approve = #{isApprove}, maintenance_file_path = #{maintenanceFilePath}, approve_file_path = #{approveFilePath}, maintenance_file_name = #{maintenanceFileName}, approve_file_name = #{approveFileName}, create_by = #{createBy}, create_time = #{createTime}, update_by = #{updateBy}, update_time = #{updateTime}, where id = #{id} delete from ads_cst_hygszdbb_pdmmaintenanceprocess_wf where id = #{id} delete from ads_cst_hygszdbb_pdmmaintenanceprocess_wf where id in #{id}