From 024afbfeb399c4d800b4fa088149d92da4d8bbbf Mon Sep 17 00:00:00 2001
From: xieb <vip_xiaobin810@163.com>
Date: Thu, 26 Sep 2024 16:03:08 +0800
Subject: [PATCH] 普查统计水库柱状图数据接口支持季节查询

---
 skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sg/mapper/SgProjectInfoMapper.xml |  104 ++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 93 insertions(+), 11 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 b030e6f..47e6c23 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
@@ -66,14 +66,33 @@
                 #{id}
             </foreach>)
         </if>
-        <if test="dto.projectSort == null or dto.projectSort ==0">
-            ORDER BY info.status desc ,info.project_progress desc
+        <if test="dto.deptId != null and dto.deptId !=''">
+            and (info.control_unit = #{dto.deptId} or info.construction_unit = #{dto.deptId})
         </if>
-        <if test="dto.projectSort ==1">
-            ORDER BY info.project_progress desc
+        <if test="dto.adCode != null and dto.adCode !=''">
+            and dria."county_cd" = #{dto.adCode}
         </if>
-        <if test="dto.projectSort != null and dto.projectSort ==2">
-            ORDER BY info.sk_id asc
+       <if test="dto.projectSort == null">
+            ORDER BY TO_NUMBER(info.project_progress) desc NULLS LAST,info.status desc
+        </if>
+        <!--
+       <if test="dto.projectSort ==1">
+           ORDER BY info.project_progress desc NULLS LAST
+       </if>
+       <if test="dto.projectSort != null and dto.projectSort ==2">
+           ORDER BY info.sk_id asc
+       </if>-->
+        <if test="dto.projectSort != null and dto.projectSort ==3">
+            ORDER BY TO_NUMBER(SUBSTR(info.surface_progress, 1, LENGTH(info.surface_progress) - 1))  desc NULLS LAST
+        </if>
+        <if test="dto.projectSort != null and dto.projectSort ==4">
+            ORDER BY TO_NUMBER(SUBSTR(info.video_progress, 1, LENGTH(info.video_progress) - 1))  desc NULLS LAST
+        </if>
+        <if test="dto.projectSort != null and dto.projectSort ==5">
+            ORDER BY TO_NUMBER(SUBSTR(info.trans_progress, 1, LENGTH(info.trans_progress) - 1))  desc NULLS LAST
+        </if>
+        <if test="dto.projectSort != null and dto.projectSort ==6">
+            ORDER BY TO_NUMBER(SUBSTR(info.seepage_progress , 1, LENGTH(info.seepage_progress ) - 1))  desc NULLS LAST
         </if>
     </select>
 
@@ -114,6 +133,7 @@
         re.resubmit
         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.sg_device d ON pro.id = d.program_id
         LEFT JOIN YWXT."BLADE_DICT_BIZ" AS dict ON d.device_type = dict.DICT_KEY AND dict.CODE = 'SG_DEVICE_TYPE'
         LEFT JOIN YWXT."BLADE_DICT_BIZ" Pdict on dict.parent_id = Pdict.id
@@ -143,6 +163,7 @@
         <if test="dto.buildStage != null and dto.buildStage != ''">
             and pro.build_stage like CONCAT(CONCAT('%',#{dto.buildStage}),'%')
         </if>
+        <include refid="queryBySgCodeS"></include>
        ORDER BY pro.status desc ,pro.project_progress desc
 
     </select>
@@ -167,6 +188,10 @@
      <if test="dto.buildStage != null and dto.buildStage != ''">
          and pro.build_stage like CONCAT(CONCAT('%',#{dto.buildStage}),'%')
      </if>
+     <if test="dto.deptId != null and dto.deptId !=''">
+         and (pro.control_unit = #{dto.deptId} or pro.construction_unit = #{dto.deptId})
+     </if>
+        ORDER BY pro.project_progress desc NULLS LAST
     </select>
     <select id="getSgstatiss" resultType="cn.gistack.sm.sg.VO.SgStatisticsVO">
         SELECT
@@ -323,10 +348,11 @@
         select DISTINCT  "bas_guid"  from SJZT_DW."dim_res_info_a" where "bas_name" = #{code}
     </select>
     <select id="progressList1" resultType="cn.gistack.sm.sg.VO.SgProjectInfoVO">
-        select pro.id,
+        select DISTINCT pro.id,
         pro.project_name,
         pro.lon_lat,
-        pro.status
+        pro.status,
+        pro.project_progress
         from
         (SELECT
         pro.id,
@@ -337,7 +363,10 @@
         pro.build_stage,
         dria."county_cd" AS countyCode,
         att."guid" AS cityCode,
-        ad."ad_code" AS provinceCode
+        ad."ad_code" AS provinceCode,
+        pro.project_progress,
+        pro.control_unit,
+        pro.construction_unit
         FROM
         ywxt.sg_project_info pro
         LEFT JOIN SJZT_DW."dim_res_info_a" dria ON dria."res_cd" = pro.sk_id
@@ -361,6 +390,10 @@
         <if test="dto.buildStage != null and dto.buildStage != ''">
             and pro.build_stage like CONCAT(CONCAT('%',#{dto.buildStage}),'%')
         </if>
+        <if test="dto.deptId != null and dto.deptId !=''">
+            and (pro.control_unit = #{dto.deptId} or pro.construction_unit = #{dto.deptId})
+        </if>
+        order by pro.project_progress desc NULLS LAST
     </select>
     <select id="queryStepByProject1" resultType="cn.gistack.sm.sg.VO.SgProjectInfoVO">
     select
@@ -417,7 +450,10 @@
         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") pro
+        LEFT JOIN YWXT."att_ad_base" aad ON aad."ad_code" = ad."p_ad_code"
+        where 1=1
+        <include refid="queryBySgCodeS"></include>
+        ) pro
         LEFT JOIN YWXT."att_ad_base" a ON (
         ( pro.countyCode = a."guid" )
         OR ( pro.cityCode = a."guid" )
@@ -446,6 +482,28 @@
         </if>
         ORDER BY pro.projectStatus desc ,pro.project_progress desc
     </select>
+
+    <sql id="queryBySgCodeS">
+        <if test="dto.sgCodeS != null and dto.sgCodeS.size > 0">
+            and (dria."province_cd" in
+            <foreach collection="dto.sgCodeS" item="id" separator="," open="(" close=")">
+                #{id}
+            </foreach>
+            or dria."city_cd" in
+            <foreach collection="dto.sgCodeS" item="id" separator="," open="(" close=")">
+                #{id}
+            </foreach>
+            or dria."county_cd" in
+            <foreach collection="dto.sgCodeS" item="id" separator="," open="(" close=")">
+                #{id}
+            </foreach>
+            or dria."town_cd" in
+            <foreach collection="dto.sgCodeS" item="id" separator="," open="(" close=")">
+                #{id}
+            </foreach>)
+        </if>
+    </sql>
+
     <select id="selectVOById" resultType="cn.gistack.sm.sg.VO.SgProjectInfoVO">
         select * from  ywxt.sg_project_info pro where pro.id = #{proframId}
     </select>
@@ -480,7 +538,7 @@
     </select>
     <select id="projectTree" resultType="cn.gistack.sm.sg.VO.SgProjectTreeVO">
         SELECT
-<!--         TOP 200 -->
+       <!--  TOP 200 -->
         info.id,
         info.lot,
         dria."province_nm",
@@ -514,5 +572,29 @@
                 #{id}
             </foreach>)
         </if>
+        <if test="dto.adCode != null and dto.adCode !=''">
+            and dria."county_cd" = #{dto.adCode}
+        </if>
+    </select>
+    <select id="getUserS" resultType="java.lang.String">
+
+        SELECT
+            user_id
+        FROM
+            "YWXT"."BLADE_USER_DEPT"
+        WHERE
+            dept_id = #{controlUnit}
+
+
+    </select>
+    <select id="resList" resultType="cn.gistack.sm.sg.VO.ResVO">
+        select dria.* from "SJZT_DW"."dim_res_info_a" dria where 1=1
+        <if test="dto.adCode != null and dto.adCode != ''">
+           and (dria."province_cd" = #{dto.adCode} or dria."city_cd" = #{dto.adCode} or dria."county_cd" = #{dto.adCode})
+        </if>
+        <if test="dto.skName != null and dto.skName != ''">
+            and dria."res_nm" like CONCAT(CONCAT('%', #{dto.skName}), '%')
+        </if>
+        <include refid="queryBySgCodeS"></include>
     </select>
 </mapper>

--
Gitblit v1.9.3