From 7f615dc1f37ccc9efd7f5b2f7e044c2e62f01074 Mon Sep 17 00:00:00 2001
From: gonglilong <328255720@qq.com>
Date: Sat, 14 Sep 2024 14:11:55 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/jtdev' into jtdev

---
 skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sg/mapper/SgProjectInfoMapper.xml |  180 ++++++++++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 152 insertions(+), 28 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 d51eb7d..26becd3 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
@@ -15,12 +15,14 @@
         LEFT JOIN SJZT_DW."dim_res_info_a" dria ON dria."res_cd" = info.sk_id
         WHERE
         1 =1
-        <include refid="sgCodeCondition" />
         <if test="dto.projectName != null and dto.projectName != ''">
             and info.project_name like concat( concat ('%',#{dto.projectName}),'%')
         </if>
         <if test="dto.skName != null and dto.skName != ''">
             and info.sk_name like concat(concat('%',#{dto.skName}),'%')
+        </if>
+        <if test="dto.lot != null and dto.lot != ''">
+            and info.lot = #{dto.lot}
         </if>
         <if test="dto.resCd != null and dto.resCd != '' ">
             and info.sk_id like CONCAT(CONCAT('%', #{dto.resCd}), '%')
@@ -37,39 +39,57 @@
         <if test="dto.isBegin != null and dto.isBegin == 2">
             and info.status = 0
         </if>
+        <if test="dto.buildStage != null and dto.buildStage != ''">
+            and info.build_stage = #{dto.buildStage}
+        </if>
         <if test="dto.projectIds != null and dto.projectIds.size > 0">
             and info.id in
          <foreach collection="dto.projectIds" item="id" separator="," open="(" close=")">
              #{id}
          </foreach>
         </if>
-        <!--<if test="dto.sgCodeS != null and dto.sgCodeS.size > 0">
-            and (dria.province_cd in
+        <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
+                or dria."city_cd" in
             <foreach collection="dto.sgCodeS" item="id" separator="," open="(" close=")">
                 #{id}
             </foreach>
-                or dria.county_cd in
+                or dria."county_cd" in
             <foreach collection="dto.sgCodeS" item="id" separator="," open="(" close=")">
                 #{id}
             </foreach>
-                or dria.town_cd in
+                or dria."town_cd" in
             <foreach collection="dto.sgCodeS" item="id" separator="," open="(" close=")">
                 #{id}
-            </foreach>
-                )
-        </if>-->
-        <if test="dto.projectSort == null or dto.projectSort ==0">
-            ORDER BY info.status desc ,info.project_progress desc
+            </foreach>)
         </if>
-        <if test="dto.projectSort ==1">
-            ORDER BY 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 != null and dto.projectSort ==2">
-            ORDER BY info.sk_id asc
+       <if test="dto.projectSort == null">
+            ORDER BY info.status desc ,info.project_progress desc NULLS LAST
+        </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 info.surface_progress desc NULLS LAST
+        </if>
+        <if test="dto.projectSort != null and dto.projectSort ==4">
+            ORDER BY info.video_progress desc NULLS LAST
+        </if>
+        <if test="dto.projectSort != null and dto.projectSort ==5">
+            ORDER BY info.trans_progress desc NULLS LAST
+        </if>
+        <if test="dto.projectSort != null and dto.projectSort ==6">
+            ORDER BY info.seepage_progress desc NULLS LAST
         </if>
     </select>
 
@@ -133,6 +153,14 @@
                 #{id}
             </foreach>
         </if>
+        <if test="dto.lot != null and dto.lot != ''">
+            and pro.lot like CONCAT(CONCAT('%',#{dto.lot}),'%')
+        </if>
+        <if test="dto.buildStage != null and dto.buildStage != ''">
+            and pro.build_stage like CONCAT(CONCAT('%',#{dto.buildStage}),'%')
+        </if>
+       ORDER BY pro.status desc ,pro.project_progress desc
+
     </select>
     <select id="progressList" resultType="cn.gistack.sm.sg.VO.SgProjectInfoVO">
        SELECT
@@ -149,6 +177,16 @@
      <if test="dto.projectName != null and dto.projectName != ''">
          and pro.project_name like CONCAT(CONCAT('%',#{dto.projectName}),'%')
      </if>
+     <if test="dto.lot != null and dto.lot != ''">
+         and pro.lot like CONCAT(CONCAT('%',#{dto.lot}),'%')
+     </if>
+     <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
@@ -182,7 +220,8 @@
 	a."ad_name" NAME,
 	SUM( CASE WHEN b.STATUS IN ( 1, 2 ) THEN 1 ELSE 0 END ) AS commenceNum,
 	count( b.STATUS ) projectSum,
-    LISTAGG(b.id, ',') as proIds
+    LISTAGG(b.id, ',') as proIds,
+    b.build_stage
 FROM
 	(
 	SELECT
@@ -190,7 +229,8 @@
 		att."guid" AS cityCode,
 		ad."ad_code" AS provinceCode,
 		info.STATUS,
-		info.id
+		info.id,
+		info.build_stage
 	FROM
 		YWXT.SG_PROJECT_INFO info
 		LEFT JOIN SJZT_DW."dim_res_info_a" dria ON dria."res_cd" = info.sk_id
@@ -206,7 +246,8 @@
 	a."p_ad_code" = #{code}
 GROUP BY
 	a."ad_code",
-	a."ad_name"
+	a."ad_name",
+    b.build_stage
     </select>
 
     <select id="getsgStatisticsZero" resultType="cn.gistack.sm.sg.VO.SgStatisProVO">
@@ -214,7 +255,8 @@
 	dria."city_cd" code, dria."city_nm" name ,
 	sum( CASE WHEN info.STATUS IN ( 1, 2 ) THEN 1 ELSE 0 END ) AS commenceNum,
 	count( info.STATUS ) projectSum,
-    LISTAGG(info.id, ',') as proIds
+    LISTAGG(info.id, ',') as proIds,
+    info.build_stage as buildStage
     FROM
 	YWXT.SG_PROJECT_INFO info
 	LEFT JOIN SJZT_DW."dim_res_info_a" dria ON dria."res_cd" = info.sk_id
@@ -223,7 +265,7 @@
     <if test="code != null and code != ''">
         AND   info.lot =#{code}
     </if>
-	Group By dria."city_cd",dria."city_nm"
+	Group By dria."city_cd",dria."city_nm",info.build_stage
 	HAVING
     dria."city_cd" IS NOT NULL AND
     dria."city_nm" IS NOT NULL
@@ -237,14 +279,15 @@
     info.lot as name,
 	sum( CASE WHEN info.STATUS IN ( 1, 2 ) THEN 1 ELSE 0 END ) AS commenceNum,
 	count( info.STATUS ) AS projectSum,
-    LISTAGG(info.id, ',') as proIds
+    LISTAGG(info.id, ',') as proIds,
+    info.build_stage
 FROM
 	YWXT.SG_PROJECT_INFO info
 	LEFT JOIN SJZT_DW."dim_res_info_a" dria ON dria."res_cd" = info.sk_id
 WHERE
 	1 = 1
 GROUP BY
-     info.lot
+     info.lot,info.build_stage
  <!--	dria."bas_guid", dria."bas_name" -->
 	HAVING
  <!--   dria."bas_guid" IS NOT NULL AND
@@ -300,19 +343,25 @@
         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,
         pro.project_name,
         pro.lon_lat,
         pro.status,
+        pro.lot,
+        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
@@ -330,6 +379,16 @@
         <if test="dto.projectName != null and dto.projectName != ''">
             and pro.project_name like CONCAT(CONCAT('%',#{dto.projectName}),'%')
         </if>
+        <if test="dto.lot != null and dto.lot != ''">
+            and pro.lot like CONCAT(CONCAT('%',#{dto.lot}),'%')
+        </if>
+        <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
@@ -348,8 +407,9 @@
         pro.deviceStatus,
         pro.projectStatus,
         pro.reportId,
-        pro.lon_lat
-    from
+        pro.lon_lat,
+        pro.project_progress
+        from
         (SELECT
         pro.id,
         pro.project_name,
@@ -369,7 +429,10 @@
         pro.lon_lat,
         dria."county_cd" AS countyCode,
         att."guid" AS cityCode,
-        ad."ad_code" AS provinceCode
+        ad."ad_code" AS provinceCode,
+        pro.project_progress,
+        pro.lot,
+        pro.build_stage
         FROM
         ywxt.sg_project_info pro
         LEFT JOIN ywxt.sg_device d ON pro.id = d.program_id
@@ -403,6 +466,13 @@
                 #{id}
             </foreach>
         </if>
+        <if test="dto.lot != null and dto.lot != ''">
+            and pro.lot like CONCAT(CONCAT('%',#{dto.lot}),'%')
+        </if>
+        <if test="dto.buildStage != null and dto.buildStage != ''">
+            and pro.build_stage like CONCAT(CONCAT('%',#{dto.buildStage}),'%')
+        </if>
+        ORDER BY pro.projectStatus desc ,pro.project_progress desc
     </select>
     <select id="selectVOById" resultType="cn.gistack.sm.sg.VO.SgProjectInfoVO">
         select * from  ywxt.sg_project_info pro where pro.id = #{proframId}
@@ -430,4 +500,58 @@
         WHERE u.id = #{userId}
 
     </select>
+    <select id="queryDept" resultType="cn.gistack.sm.sg.VO.SgAllDeptOrUser">
+        select id,full_name as name from "YWXT"."BLADE_DEPT"
+    </select>
+    <select id="queryUser" resultType="cn.gistack.sm.sg.VO.SgAllDeptOrUser">
+        select id,real_name as name from "YWXT"."BLADE_USER";
+    </select>
+    <select id="projectTree" resultType="cn.gistack.sm.sg.VO.SgProjectTreeVO">
+        SELECT
+<!--         TOP 200 -->
+        info.id,
+        info.lot,
+        dria."province_nm",
+        dria."city_nm",
+        dria."county_nm",
+        dria."town_nm",
+        dria."res_nm"
+        FROM
+        YWXT.SG_PROJECT_INFO info
+                LEFT JOIN SJZT_DW."dim_res_info_a" dria ON dria."res_cd" = info.sk_id
+        WHERE
+            1 =1
+        <if test="dto.buildStage != null and dto.buildStage != ''">
+            and info.build_stage = #{dto.buildStage}
+        </if>
+        <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>
+    </select>
+    <select id="getUserS" resultType="java.lang.String">
+
+        SELECT
+            user_id
+        FROM
+            "YWXT"."BLADE_USER_DEPT"
+        WHERE
+            dept_id = #{controlUnit}
+
+
+    </select>
 </mapper>

--
Gitblit v1.9.3