From f73dbcd6c21d28ab1e98840eee73c6d09bd0f929 Mon Sep 17 00:00:00 2001
From: ke <893754509@qq.com>
Date: Tue, 27 Aug 2024 17:31:07 +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 |   90 ++++++++++++++++++++++++++++++++++++++------
 1 files changed, 77 insertions(+), 13 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 24c0609..13b2dde 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
@@ -42,6 +42,24 @@
              #{id}
          </foreach>
         </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>
         <if test="dto.projectSort == null or dto.projectSort ==0">
             ORDER BY info.status desc ,info.project_progress desc
         </if>
@@ -52,6 +70,20 @@
             ORDER BY info.sk_id asc
         </if>
     </select>
+
+    <sql id="sgCodeCondition">
+        <if test="dto.sgCodeS != null and dto.sgCodeS.size() > 0">
+            AND (
+            <foreach collection="dto.sgCodeS" item="id" separator="OR" open="(" close=")">
+                dria.province_cd = #{id}
+                OR dria.city_cd = #{id}
+                OR dria.county_cd = #{id}
+                or dria.town_cd = #{id}
+            </foreach>
+            )
+        </if>
+    </sql>
+
     <select id="queryStepByProject" resultType="cn.gistack.sm.sg.VO.SgProjectInfoVO">
 
         SELECT
@@ -60,6 +92,8 @@
         gx.id AS gxId,
         gx.gx_name,
         d.device_name,
+        Pdict.dict_key as Ptype,
+        Pdict.dict_value as PtypeName,
         d.device_type,
         dict."DICT_VALUE" AS typeName,
         d.id AS dId,
@@ -70,12 +104,13 @@
         d.STATUS AS deviceStatus,
         pro.STATUS AS projectStatus,
         re.id AS reportId,
-        pro.lon_lat
+        pro.lon_lat,
+        re.resubmit
         FROM
         ywxt.sg_project_info pro
         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" 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
         LEFT JOIN ywxt.sg_gx gx ON d.device_type = gx.gx_type
         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
@@ -96,6 +131,8 @@
                 #{id}
             </foreach>
         </if>
+       ORDER BY pro.status desc ,pro.project_progress desc
+
     </select>
     <select id="progressList" resultType="cn.gistack.sm.sg.VO.SgProjectInfoVO">
        SELECT
@@ -144,14 +181,16 @@
 	a."ad_code" CODE,
 	a."ad_name" NAME,
 	SUM( CASE WHEN b.STATUS IN ( 1, 2 ) THEN 1 ELSE 0 END ) AS commenceNum,
-	count( b.STATUS ) projectSum
+	count( b.STATUS ) projectSum,
+    LISTAGG(b.id, ',') as proIds
 FROM
 	(
 	SELECT
 		dria."county_cd" AS countyCode,
 		att."guid" AS cityCode,
 		ad."ad_code" AS provinceCode,
-		info.STATUS
+		info.STATUS,
+		info.id
 	FROM
 		YWXT.SG_PROJECT_INFO info
 		LEFT JOIN SJZT_DW."dim_res_info_a" dria ON dria."res_cd" = info.sk_id
@@ -174,8 +213,9 @@
         SELECT
 	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
-        FROM
+	count( info.STATUS ) projectSum,
+    LISTAGG(info.id, ',') as proIds
+    FROM
 	YWXT.SG_PROJECT_INFO info
 	LEFT JOIN SJZT_DW."dim_res_info_a" dria ON dria."res_cd" = info.sk_id
     WHERE
@@ -196,7 +236,8 @@
     info.lot as code,
     info.lot as name,
 	sum( CASE WHEN info.STATUS IN ( 1, 2 ) THEN 1 ELSE 0 END ) AS commenceNum,
-	count( info.STATUS ) AS projectSum
+	count( info.STATUS ) AS projectSum,
+    LISTAGG(info.id, ',') as proIds
 FROM
 	YWXT.SG_PROJECT_INFO info
 	LEFT JOIN SJZT_DW."dim_res_info_a" dria ON dria."res_cd" = info.sk_id
@@ -307,8 +348,9 @@
         pro.deviceStatus,
         pro.projectStatus,
         pro.reportId,
-        pro.lon_lat
-    from
+        pro.lon_lat,
+        pro.project_progress
+        from
         (SELECT
         pro.id,
         pro.project_name,
@@ -328,7 +370,8 @@
         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
         FROM
         ywxt.sg_project_info pro
         LEFT JOIN ywxt.sg_device d ON pro.id = d.program_id
@@ -362,11 +405,32 @@
                 #{id}
             </foreach>
         </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}
     </select>
-    <!--    <select id="getProjectIds" resultType="java.lang.String">-->
 
-<!--    </select>-->
+    <select id="getDeviceTypes" resultType="cn.gistack.sm.sg.VO.SgStatisDeviceVO">
+        SELECT
+            count( d.id) AS deviceCount,
+            sum( CASE WHEN d.STATUS IN ( 1, 2 ) THEN 1 ELSE 0 END) deviceStart,
+            Pdict.DICT_KEY as pType
+        FROM
+            ywxt.sg_device d
+                LEFT JOIN ywxt.blade_dict_biz dict ON d.device_type = dict.DICT_KEY
+                LEFT JOIN YWXT."BLADE_DICT_BIZ" Pdict ON dict.parent_id = Pdict.id
+        WHERE program_id IN ${s}
+        GROUP BY
+            Pdict.DICT_KEY
+    </select>
+    <select id="getSgCodeByUser" resultType="java.lang.String">
+        SELECT
+            dp."SG_CODE"
+        FROM
+            ywxt.BLADE_USER u
+                LEFT JOIN ywxt.blade_dept dp ON u.dept_id = cast( dp.id AS VARCHAR )
+        WHERE u.id = #{userId}
+
+    </select>
 </mapper>

--
Gitblit v1.9.3