From becd74a14cdcc8abf41788a5735d185ffa48d24b Mon Sep 17 00:00:00 2001
From: yxm <zhp1521624>
Date: Fri, 05 Jul 2024 17:00:14 +0800
Subject: [PATCH] 首页项目统计柱状图列表饼状图

---
 skjcmanager/skjcmanager-service/skjcmanager-sm/src/main/java/cn/gistack/sm/sg/mapper/SgProjectInfoMapper.xml |  179 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 174 insertions(+), 5 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 7bab072..6356257 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
@@ -3,12 +3,29 @@
 <mapper namespace="cn.gistack.sm.sg.mapper.SgProjectInfoMapper">
 
     <select id="queryPageList" resultType="cn.gistack.sm.sg.DO.SgProjectInfoDO">
-        select * from YWXT.SG_PROJECT_INFO info where 1=1
+        SELECT
+        info.*,
+        dria."city_nm",
+        dria."county_nm",
+        dria."town_nm",
+        dria."eng_scal",
+        dria."bas_guid"
+        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.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.projectIds != null and dto.projectIds.size > 0">
+            and info.id in
+         <foreach collection="dto.projectIds" item="id" separator="," open="(" close=")">
+             #{id}
+         </foreach>
         </if>
     </select>
     <select id="queryStepByProject" resultType="cn.gistack.sm.sg.VO.SgProjectInfoVO">
@@ -23,10 +40,12 @@
         d.id as dId,
         step.gx_step_name,
         step.gx_step_num,
+        step.id as stepId,
         re.STATUS as reportStatus,
         d.STATUS as deviceStatus,
         pro.STATUS as projectStatus,
-        re.id as reportId
+        re.id as reportId,
+        pro.lon_lat
         FROM
         ywxt.sg_project_info pro
         LEFT JOIN ywxt.sg_device d ON pro.id = d.program_id
@@ -41,15 +60,24 @@
         <if test="dto.projectName != null and dto.projectName != ''">
             and pro.project_name like CONCAT(CONCAT('%', #{dto.projectName}), '%')
         </if>
+        <if test="dto.status != null">
+            and pro.status = #{dto.status}
+        </if>
+        <if test="dto.projectIds != null and dto.projectIds.size > 0">
+            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
             pro.id,
             pro.project_name,
-            de.STATUS as deviceStatus
+            pro.lon_lat,
+            pro.status
         FROM
-            ywxt.sg_project_info pro
-                LEFT JOIN ywxt.sg_device de ON pro.id = de.program_id where 1=1
+            ywxt.sg_project_info pro where 1=1
     <if test="dto.status != null">
         and pro.status = #{dto.status}
     </if>
@@ -57,4 +85,145 @@
          and pro.project_name like CONCAT(CONCAT('%',#{dto.projectName}),'%')
      </if>
     </select>
+    <select id="getSgstatiss" resultType="cn.gistack.sm.sg.VO.SgStatisticsVO">
+        SELECT
+	        SUM( CASE WHEN info.STATUS = 0 THEN 1 ELSE 0 END ) AS noCommenceNum,
+	        SUM( CASE WHEN info.STATUS IN ( 1, 2 ) THEN 1 ELSE 0 END ) AS commenceNum,
+	        count( info.STATUS ) projectSum
+        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="grad == 0">
+            AND
+            dria."bas_name" = #{code}
+        </if>
+        <if test="grad == 2">
+            AND
+            dria."city_cd" = #{code}
+        </if>
+        <if test="grad == 3">
+            AND
+            dria."county_cd" = #{code}
+        </if>
+
+
+    </select>
+
+    <select id="getsgStatisticsList" resultType="cn.gistack.sm.sg.VO.SgStatisProVO">
+    SELECT
+	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
+FROM
+	(
+	SELECT
+		dria."county_cd" AS countyCode,
+		att."guid" AS cityCode,
+		ad."ad_code" AS provinceCode,
+		info.STATUS
+	FROM
+		YWXT.SG_PROJECT_INFO info
+		LEFT JOIN SJZT_DW."dim_res_info_a" dria ON dria."res_cd" = info.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
+	a."p_ad_code" = #{code}
+GROUP BY
+	a."ad_code",
+	a."ad_name"
+    </select>
+
+    <select id="getsgStatisticsZero" resultType="cn.gistack.sm.sg.VO.SgStatisProVO">
+        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
+	YWXT.SG_PROJECT_INFO info
+	LEFT JOIN SJZT_DW."dim_res_info_a" dria ON dria."res_cd" = info.sk_id
+        WHERE
+	1 = 1
+        AND
+	dria."bas_name" =#{code}
+	Group By dria."city_cd",dria."city_nm"
+	HAVING
+    dria."city_cd" IS NOT NULL AND
+    dria."city_nm" IS NOT NULL
+    </select>
+
+    <select id="getsgStatisticsOne" resultType="cn.gistack.sm.sg.VO.SgStatisProVO">
+     SELECT
+	dria."bas_name" AS code,
+	dria."bas_guid" AS name,
+	sum( CASE WHEN info.STATUS IN ( 1, 2 ) THEN 1 ELSE 0 END ) AS commenceNum,
+	count( info.STATUS ) AS projectSum
+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
+	dria."bas_guid",
+	dria."bas_name"
+	HAVING
+    dria."bas_guid" IS NOT NULL AND
+    dria."bas_name" IS NOT NULL
+    </select>
+
+    <select id="getProjectId" resultType="java.lang.String">
+        select id from YWXT.SG_PROJECT_INFO info
+        LEFT JOIN SJZT_DW."dim_res_info_a" dria ON dria."res_cd" = info.sk_id
+        where info.STATUS<![CDATA[<>]]>'0' and 1=1
+        <if test="grad == 0">
+            AND
+            dria."bas_name" = #{code}
+        </if>
+        <if test="grad == 2">
+            AND
+            dria."city_cd" = #{code}
+        </if>
+        <if test="grad == 3">
+            AND
+            dria."county_cd" = #{code}
+        </if>
+    </select>
+    <select id="getSgdevices" resultType="cn.gistack.sm.sg.VO.SgStatistccVO">
+        	SELECT
+	dict."DICT_VALUE" AS typeName,
+	dict.CODE code,
+	count(ds.ID) as deviceNum
+FROM
+	YWXT."SG_DEVICE" AS ds
+	LEFT JOIN YWXT."SG_PROJECT_INFO" AS project ON ds.program_id = project.id
+	LEFT JOIN YWXT."BLADE_DICT_BIZ" AS dict ON ds.device_type = dict.DICT_KEY
+	AND dict.CODE = 'SG_DEVICE_TYPE'
+	LEFT JOIN SJZT_DW."dim_res_info_a" dria ON dria."res_cd" = project.sk_id
+WHERE
+	1 =1
+        <if test="grad == 0">
+            AND
+            dria."bas_name" = #{code}
+        </if>
+        <if test="grad == 2">
+            AND
+            dria."city_cd" = #{code}
+        </if>
+        <if test="grad == 3">
+            AND
+            dria."county_cd" = #{code}
+        </if>
+	Group By dict.CODE,dict."DICT_VALUE"
+    </select>
+    <!--    <select id="getProjectIds" resultType="java.lang.String">-->
+
+<!--    </select>-->
 </mapper>

--
Gitblit v1.9.3