From b462e69215b38bba4a91e1406493cad5c14b35ea Mon Sep 17 00:00:00 2001
From: yxm <zhp1521624>
Date: Tue, 16 Jul 2024 17:33:31 +0800
Subject: [PATCH] 项目进度上报逻辑优化

---
 skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sg/mapper/SgProjectInfoMapper.xml |   66 ++++----------------------------
 1 files changed, 9 insertions(+), 57 deletions(-)

diff --git a/skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sg/mapper/SgProjectInfoMapper.xml b/skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sg/mapper/SgProjectInfoMapper.xml
index b9b1fe0..4364439 100644
--- a/skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sg/mapper/SgProjectInfoMapper.xml
+++ b/skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sg/mapper/SgProjectInfoMapper.xml
@@ -29,25 +29,7 @@
         </if>
     </select>
     <select id="queryStepByProject" resultType="cn.gistack.sm.sg.VO.SgProjectInfoVO">
-        SELECT
-        b.id,
-        b.project_name,
-        b.gxId,
-        b.gx_name,
-        b.device_name,
-        b.device_type,
-        b.typeName,
-        b.dId,
-        b.gx_step_name,
-        b.gx_step_num,
-        b.stepId,
-        b.reportStatus,
-        b.deviceStatus,
-        b.projectStatus,
-        b.reportId,
-        b.lon_lat
-        FROM
-        (
+
         SELECT
         pro.id,
         pro.project_name,
@@ -64,10 +46,7 @@
         d.STATUS AS deviceStatus,
         pro.STATUS AS projectStatus,
         re.id AS reportId,
-        pro.lon_lat,
-        dria."county_cd" AS countyCode,
-        att."guid" AS cityCode,
-        ad."ad_code" AS provinceCode
+        pro.lon_lat
         FROM
         ywxt.sg_project_info pro
         LEFT JOIN ywxt.sg_device d ON pro.id = d.program_id
@@ -77,41 +56,25 @@
         LEFT JOIN ywxt.sg_gx_step step ON gx.id = step.gx_info_id
         LEFT JOIN ywxt.sg_progress_report re ON re.gx_step_id = step.id
         AND re.gx_device_id = d.id
-        LEFT JOIN SJZT_DW."dim_res_info_a" dria ON dria."res_cd" = pro.sk_id
-        LEFT JOIN YWXT."att_ad_base" att ON att."ad_code" = dria."city_cd"
-        LEFT JOIN YWXT."att_ad_base" ad ON att."p_ad_code" = ad."ad_code"
-        LEFT JOIN YWXT."att_ad_base" aad ON aad."ad_code" = ad."p_ad_code"
-        ) b
-        LEFT JOIN YWXT."att_ad_base" a ON (
-        ( b.countyCode = a."guid" )
-        OR ( b.cityCode = a."guid" )
-        OR ( b.provinceCode = a."guid" ))
         where 1=1
-          <if test="dto.adCode != null">
-        and a."p_ad_code" = #{dto.adCode}
-    </if>
         <if test="dto.projectId != null and dto.projectId != ''">
-            and b.id = #{dto.projectId}
+            and pro.id = #{dto.projectId}
         </if>
         <if test="dto.projectName != null and dto.projectName != ''">
-            and b.project_name like CONCAT(CONCAT('%', #{dto.projectName}), '%')
+            and pro.project_name like CONCAT(CONCAT('%', #{dto.projectName}), '%')
         </if>
         <if test="dto.status != null">
-            and b.status = #{dto.status}
+            and pro.status = #{dto.status}
         </if>
         <if test="dto.projectIds != null and dto.projectIds.size > 0">
-            and b.id in
+            and pro.id in
             <foreach collection="dto.projectIds" item="id" separator="," open="(" close=")">
                 #{id}
             </foreach>
         </if>
     </select>
     <select id="progressList" resultType="cn.gistack.sm.sg.VO.SgProjectInfoVO">
-        select  b.id,
-        b.project_name,
-        b.lon_lat,
-        b.status from
-        (SELECT
+       SELECT
         pro.id,
         pro.project_name,
         pro.lon_lat,
@@ -121,23 +84,12 @@
         ad."ad_code" AS provinceCode
         FROM
         ywxt.sg_project_info pro
-        LEFT JOIN SJZT_DW."dim_res_info_a" dria ON dria."res_cd" = pro.sk_id
-        LEFT JOIN YWXT."att_ad_base" att ON att."ad_code" = dria."city_cd"
-        LEFT JOIN YWXT."att_ad_base" ad ON att."p_ad_code" = ad."ad_code"
-        LEFT JOIN YWXT."att_ad_base" aad ON aad."ad_code" = ad."p_ad_code")b
-        LEFT JOIN YWXT."att_ad_base" a ON (
-        ( b.countyCode = a."guid" )
-        OR ( b.cityCode = a."guid" )
-        OR ( b.provinceCode = a."guid" ))
         WHERE 1=1
-        <if test="dto.adCode != null">
-        and a."p_ad_code" = #{dto.adCode}
-        </if>
         <if test="dto.status != null">
-        and b.status = #{dto.status}
+        and pro.status = #{dto.status}
     </if>
      <if test="dto.projectName != null and dto.projectName != ''">
-         and b.project_name like CONCAT(CONCAT('%',#{dto.projectName}),'%')
+         and pro.project_name like CONCAT(CONCAT('%',#{dto.projectName}),'%')
      </if>
     </select>
     <select id="getSgstatiss" resultType="cn.gistack.sm.sg.VO.SgStatisticsVO">

--
Gitblit v1.9.3