zhaoyun 5 달 전
부모
커밋
9091ffd73b
1개의 변경된 파일9개의 추가작업 그리고 5개의 파일을 삭제
  1. 9 5
      ruoyi-powerdistribution/src/main/resources/mapper/powerdistribution/PdmMaintenanceProcessMapper.xml

+ 9 - 5
ruoyi-powerdistribution/src/main/resources/mapper/powerdistribution/PdmMaintenanceProcessMapper.xml

@@ -42,12 +42,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <sql id="selectPdmMaintenanceProcessVo">
         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 pdm_maintenance_process
     </sql>
-
-    <select id="selectPdmMaintenanceProcessList" parameterType="PdmMaintenanceProcess" resultMap="PdmMaintenanceProcessResult">
-        select a.*,getExamiAmountFun((select ROUND(sum(hour_num))  from pdm_stop_records where std_county_org_no=a.std_county_org_no
+    <sql id="selectPdmMaintenanceProcessVo2">
+        select (select ROUND(sum(hour_num))
+        from pdm_stop_records r
+        where REPLACE(r.line_nm,' ','')=REPLACE(p.line_name,' ','')
         and poweroff_nature_cd in('2111','2112','2121','2122','2141','2211','2212','2221','2231','2241')
-        and DATE_FORMAT(poweroff_start_tm, '%Y-%m-%d') &gt;= a.week_start_dt
-        and DATE_FORMAT(poweroff_term_tm, '%Y-%m-%d') &lt;= a.week_end_dt),per_hour_households_w) exami_Amount   from ( <include refid="selectPdmMaintenanceProcessVo"/>
+        and DATE_FORMAT(poweroff_start_tm, '%Y-%m-%d') &gt;= week_start_dt
+        and DATE_FORMAT(poweroff_term_tm, '%Y-%m-%d') &lt;= 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 pdm_maintenance_process p
+    </sql>
+    <select id="selectPdmMaintenanceProcessList" parameterType="PdmMaintenanceProcess" resultMap="PdmMaintenanceProcessResult">
+        select a.*,getExamiAmountFun(hour_num,per_hour_households_w) exami_Amount   from ( <include refid="selectPdmMaintenanceProcessVo2"/>
         <where>
             <if test="planCode != null  and planCode != ''"> and plan_code like concat('%', #{planCode}, '%')</if>
             <if test="planCodeW != null  and planCodeW != ''"> and plan_code_w like concat('%', #{planCodeW}, '%')</if>