Parcourir la source

【CHG】修改查询条件

zhaomn il y a 2 ans
Parent
commit
c2f2b9366f

+ 11 - 6
railway-business/src/main/resources/mapper/bi/ShowBdycMapper.xml

@@ -228,6 +228,7 @@
     FROM show_bdyc
     <where>
       del_flag='0'
+      and file_id = (select max(id) from show_file where data_type='yctj' and imp_result = '1')
       <if test="gravity!=null and gravity!=''">
         and qxdj=(select dict_label from sys_dict_data where dict_type='dlycyzx' and
         dict_value=#{gravity})
@@ -244,10 +245,8 @@
       </if>
       <if test="rectifyResult!=null and rectifyResult!=''">
         and rectify_result =
-        (select dict_label from sys_dict_data where dict_type='bdyc_clqk' and dict_value=#{rectifyResult})
-      </if>
-      <if test="fileId!=null ">
-        and file_id=#{fileId}
+        (select dict_label from sys_dict_data where dict_type='bdyc_clqk' and
+        dict_value=#{rectifyResult})
       </if>
       <if test="foundMode!=null and foundMode!=''">
         and found_mode=#{foundMode}
@@ -256,13 +255,19 @@
   </select>
 
   <select id="totalByDay" resultType="com.railway.business.bi.domain.dto.DlycDTO">
-    select t1.dict_label as gq, t1.dict_value as gqCode, sum(yj) as dj1, sum(ej) as dj2, sum(sj) as dj3
+    select t1.dict_label as gq,
+           t1.dict_value as gqCode,
+           sum(yj)       as dj1,
+           sum(ej)       as dj2,
+           sum(sj)       as dj3
     from (select sjgq,
                  case when qxdj = '一级' then 1 else 0 end as yj,
                  case when qxdj = '二级' then 1 else 0 end as ej,
                  case when qxdj = '三级' then 1 else 0 end as sj
           from show_bdyc
-          where found_date = '2022-05-25'
+          where del_flag = '0'
+            and file_id =
+                (select max(id) from show_file where data_type = 'yctj' and imp_result = '1')
             and sjgq is not null) x
            right join sys_dict_data t1 on x.sjgq = t1.dict_label
     where t1.dict_type = 'dlyc_sygq'

+ 0 - 3
railway-business/src/main/resources/mapper/bi/ShowBpdjxjhMapper.xml

@@ -160,9 +160,6 @@
       <if test="jhMonth!=null and jhMonth!=''">
         and jh_month like concat('%', #{jhMonth})
       </if>
-      <if test="fileId!=null ">
-        and file_id=#{fileId}
-      </if>
     </where>
   </select>
 

+ 9 - 5
railway-business/src/main/resources/mapper/bi/ShowDlycMapper.xml

@@ -219,6 +219,7 @@
     FROM show_dlyc
     <where>
       del_flag='0'
+      and file_id = (select max(id) from show_file where data_type='yctj' and imp_result = '1')
       <if test="gravity!=null and gravity!=''">
         and gravity=(select dict_label from sys_dict_data where dict_type='dlycyzx' and
         dict_value=#{gravity})
@@ -233,9 +234,6 @@
       <if test="rectifyResult!=null and rectifyResult!=''">
         and rectify_result like concat('%', #{rectifyResult}, '%')
       </if>
-      <if test="fileId!=null ">
-        and file_id=#{fileId}
-      </if>
       <if test="foundMode!=null and foundMode!=''">
         and found_mode=#{foundMode}
       </if>
@@ -243,13 +241,19 @@
   </select>
 
   <select id="totalByDay" resultType="com.railway.business.bi.domain.dto.DlycDTO">
-    select t1.dict_label as gq, t1.dict_value as gqCode, sum(yj) as dj1, sum(ej) as dj2, sum(sj) as dj3
+    select t1.dict_label as gq,
+           t1.dict_value as gqCode,
+           sum(yj)       as dj1,
+           sum(ej)       as dj2,
+           sum(sj)       as dj3
     from (select ssgq,
                  case when gravity = '一级' then 1 else 0 end as yj,
                  case when gravity = '二级' then 1 else 0 end as ej,
                  case when gravity = '三级' then 1 else 0 end as sj
           from show_dlyc
-          where found_date = '2021-11-10'
+          where del_flag = '0'
+            and file_id =
+                (select max(id) from show_file where data_type = 'yctj' and imp_result = '1')
             and ssgq is not null) x
            right join sys_dict_data t1 on x.ssgq = t1.dict_label
     where t1.dict_type = 'dlyc_sygq'

+ 1 - 3
railway-business/src/main/resources/mapper/bi/ShowGsdMapper.xml

@@ -239,15 +239,13 @@
     FROM show_gsd
     <where>
       del_flag='0'
+      and file_id = (select max(id) from show_file where data_type = 'scrw' and imp_result = '1')
       <if test="wxfs!=null and wxfs!=''">
         and wxfs like concat('%', #{wxfs}, '%')
       </if>
       <if test="planMonth!=null and planMonth!=''">
         and plan_month like concat('%', #{planMonth})
       </if>
-      <if test="fileId!=null ">
-        and file_id=#{fileId}
-      </if>
     </where>
   </select>
 

+ 1 - 3
railway-business/src/main/resources/mapper/bi/ShowGsyMapper.xml

@@ -204,15 +204,13 @@
     FROM show_gsy
     <where>
       del_flag='0'
+      and file_id = (select max(id) from show_file where data_type = 'scrw' and imp_result = '1')
       <if test="testPlanMonth!=null and testPlanMonth!=''">
         and LPAD(MONTH(test_plan1), 2, 0) like concat('%', #{testPlanMonth})
       </if>
       <if test="completionMonth!=null and completionMonth!=''">
         and completion_date1=#{completionMonth}
       </if>
-      <if test="fileId!=null ">
-        and file_id=#{fileId}
-      </if>
     </where>
   </select>
 

+ 43 - 26
railway-business/src/main/resources/mapper/bi/ShowSbxjMapper.xml

@@ -384,12 +384,10 @@
     FROM show_sbxj
     <where>
       del_flag='0'
+      and file_id = (select max(id) from show_file where data_type = 'xjdx' and imp_result = '1')
       <if test="teamName!=null and teamName!=''">
         and team_name like concat('%', #{teamName}, '%')
       </if>
-      <if test="fileId!=null ">
-        and file_id=#{fileId}
-      </if>
     </where>
   </select>
 
@@ -412,24 +410,30 @@
     sum(plan) as planTotal,
     sum(actual) as actualTotal,
     round(sum(actual) * 100 / sum(plan)) as dx
-    from (select dept_name,
-    team_name,
-    case when plan is not null then 1 else 0 end as plan,
-    case when actual is not null then 1 else 0 end as actual
-    from (select dept_name, team_name,
-    <if test="month==1">plan1 as plan, actual1 as actual</if>
-    <if test="month==2">plan2 as plan, actual2 as actual</if>
-    <if test="month==3">plan3 as plan, actual3 as actual</if>
-    <if test="month==4">plan4 as plan, actual4 as actual</if>
-    <if test="month==5">plan5 as plan, actual5 as actual</if>
-    <if test="month==6">plan6 as plan, actual6 as actual</if>
-    <if test="month==7">plan7 as plan, actual7 as actual</if>
-    <if test="month==8">plan8 as plan, actual8 as actual</if>
-    <if test="month==9">plan9 as plan, actual9 as actual</if>
-    <if test="month==10">plan10 as plan, actual10 as actual</if>
-    <if test="month==11">plan11 as plan, actual11 as actual</if>
-    <if test="month==12">plan12 as plan, actual12 as actual</if>
-    from show_sbxj) a) b
+    from (
+      select dept_name,
+      team_name,
+      case when plan is not null then 1 else 0 end as plan,
+      case when actual is not null then 1 else 0 end as actual
+      from (
+        select dept_name, team_name,
+        <if test="month==1">plan1 as plan, actual1 as actual</if>
+        <if test="month==2">plan2 as plan, actual2 as actual</if>
+        <if test="month==3">plan3 as plan, actual3 as actual</if>
+        <if test="month==4">plan4 as plan, actual4 as actual</if>
+        <if test="month==5">plan5 as plan, actual5 as actual</if>
+        <if test="month==6">plan6 as plan, actual6 as actual</if>
+        <if test="month==7">plan7 as plan, actual7 as actual</if>
+        <if test="month==8">plan8 as plan, actual8 as actual</if>
+        <if test="month==9">plan9 as plan, actual9 as actual</if>
+        <if test="month==10">plan10 as plan, actual10 as actual</if>
+        <if test="month==11">plan11 as plan, actual11 as actual</if>
+        <if test="month==12">plan12 as plan, actual12 as actual</if>
+        from show_sbxj
+        where del_flag='0'
+        and file_id = (select max(id) from show_file where data_type = 'xjdx' and imp_result = '1')
+      ) a
+    ) b
     group by dept_name, team_name
 
     union
@@ -460,7 +464,10 @@
     <if test="month==11">plan11 as plan, actual11 as actual</if>
     <if test="month==12">plan12 as plan, actual12 as actual</if>
     from show_sbxj
-    where xb is not null) a) b
+    where del_flag='0'
+    and file_id = (select max(id) from show_file where data_type = 'xjdx' and imp_result = '1')
+    and xb is not null
+    ) a) b
     group by dept_name, team_name
 
     union
@@ -491,7 +498,9 @@
     <if test="month==11">plan11 as plan, actual11 as actual</if>
     <if test="month==12">plan12 as plan, actual12 as actual</if>
     from show_sbxj
-    where bds is not null) a) b
+    where del_flag='0'
+    and file_id = (select max(id) from show_file where data_type = 'xjdx' and imp_result = '1')
+    and qybds is not null) a) b
     group by dept_name, team_name
 
     union
@@ -522,7 +531,11 @@
     <if test="month==11">plan11 as plan, actual11 as actual</if>
     <if test="month==12">plan12 as plan, actual12 as actual</if>
     from show_sbxj
-    where pds is not null) a) b
+    where del_flag='0'
+    and file_id = (select max(id) from show_file where data_type = 'xjdx' and imp_result = '1')
+      <!-- 配电所 包含 配电所 和 10/0.4变电所 -->
+    and (pds is not null or bds is null)
+    ) a) b
     group by dept_name, team_name
 
     union
@@ -553,7 +566,9 @@
     <if test="month==11">plan11 as plan, actual11 as actual</if>
     <if test="month==12">plan12 as plan, actual12 as actual</if>
     from show_sbxj
-    where sdxl is not null) a) b
+    where del_flag='0'
+    and file_id = (select max(id) from show_file where data_type = 'xjdx' and imp_result = '1')
+    and sdxl is not null) a) b
     group by dept_name, team_name
   </select>
 
@@ -588,7 +603,9 @@
     <if test="month==11">plan11 as plan, actual11 as actual</if>
     <if test="month==12">plan12 as plan, actual12 as actual</if>
     from show_sbxj
-    where sdxl is not null) a) b
+    where del_flag='0'
+    and file_id = (select max(id) from show_file where data_type = 'xjdx' and imp_result = '1')
+    and sdxl is not null) a) b
     group by dept_name, team_name
   </select>
 

+ 1 - 4
railway-business/src/main/resources/mapper/bi/ShowTestPlanDtMapper.xml

@@ -150,6 +150,7 @@
     FROM show_test_plan_dt
     <where>
       del_flag='0'
+      and file_id = (select max(id) from show_file where data_type = 'jxjhdx' and imp_result = '1')
       <if test="lineName!=null and lineName!=''">
         and line_name like concat('%', #{lineName}, '%')
       </if>
@@ -171,10 +172,6 @@
       <if test="completionDateEnd!=null">
         and completion_date <![CDATA[ <= ]]> #{completionDateEnd}
       </if>
-
-      <if test="fileId!=null ">
-        and file_id=#{fileId}
-      </if>
     </where>
   </select>
 

+ 1 - 3
railway-business/src/main/resources/mapper/bi/ShowTestPlanKgMapper.xml

@@ -132,6 +132,7 @@
     FROM show_test_plan_kg
     <where>
       del_flag='0'
+      and file_id = (select max(id) from show_file where data_type = 'jxjhdx' and imp_result = '1')
       <if test="lineName!=null and lineName!=''">
         and line_name like concat('%', #{lineName}, '%')
       </if>
@@ -150,9 +151,6 @@
       <if test="completionDateEnd!=null">
         and completion_date <![CDATA[ <= ]]> #{completionDateEnd}
       </if>
-      <if test="fileId!=null ">
-        and file_id=#{fileId}
-      </if>
     </where>
   </select>
 

+ 1 - 3
railway-business/src/main/resources/mapper/bi/ShowYdtsMapper.xml

@@ -222,15 +222,13 @@
     FROM show_ydts
     <where>
       del_flag='0'
+      and file_id = (select max(id) from show_file where data_type = 'scrw' and imp_result = '1')
       <if test="lineName!=null and lineName!=''">
         and line_name like concat('%', #{lineName}, '%')
       </if>
       <if test="planMonth!=null and planMonth!=''">
         and plan_month like concat('%', #{planMonth})
       </if>
-      <if test="fileId!=null ">
-        and file_id=#{fileId}
-      </if>
     </where>
   </select>