From 1c285b38777e9f37ee8d112e994443d3640b78c1 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期一, 25 三月 2024 13:47:07 +0800
Subject: [PATCH] 解决查询出错

---
 src/main/resources/mapper/sys/ReportMapper.xml |  162 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 161 insertions(+), 1 deletions(-)

diff --git a/src/main/resources/mapper/sys/ReportMapper.xml b/src/main/resources/mapper/sys/ReportMapper.xml
index 28c455d..5b6dfaa 100644
--- a/src/main/resources/mapper/sys/ReportMapper.xml
+++ b/src/main/resources/mapper/sys/ReportMapper.xml
@@ -304,7 +304,7 @@
         order by code;
     </select>
 
-    <!-- 鎸夐」鐩粺璁″湴璐ㄦā鍨嬮潰绉� -->
+    <!-- 鎸夐」鐩粺璁′笁缁村湴璐ㄦā鍨嬮潰绉� -->
     <select id="countGeoModelAreaByPrj" resultType="com.lf.server.entity.ctrl.CountEntity">
         select name "m1",
           (select cast( coalesce(sum(b.area), 0) as decimal(20, 2) )
@@ -322,4 +322,164 @@
         where pid = 0
         order by code;
     </select>
+
+    <!-- 椤圭洰鏁版嵁鍒嗙被缁熻 -->
+    <select id="countVariousDataByPrj" resultType="com.lf.server.entity.ctrl.CountEntity">
+        (select '鏁板瓧绾垮垝鍥�' "m1", 'area' "m2", 0 "count", cast( coalesce(sum(area), 0) as decimal(20, 2) ) "area", 0 "len"
+            from lf.sys_line_buffer
+            <where>
+                <if test="null != code">
+                    code like #{code}
+                </if>
+            </where>
+        )
+        union all
+        (select '鏁板瓧楂樼▼妯″瀷' "m1", 'area' "m2", 0 "count", cast( coalesce(sum(b.area), 0) as decimal(20, 2) ) "area", 0 "len"
+            from lf.sys_meta b inner join lf.sys_dir c on b.dircode = c.code
+            <where>
+                c.name = '鏁板瓧楂樼▼妯″瀷' and b.type in ('dem', 'tif', 'tiff')
+                <if test="null != code">
+                    and b.dircode like #{code}
+                </if>
+            </where>
+        )
+        union all
+        (select '鏁板瓧姝e皠褰卞儚鍥�' "m1", 'area' "m2", 0 "count", cast( coalesce(sum(b.area), 0) as decimal(20, 2) ) "area", 0 "len"
+            from lf.sys_meta b inner join lf.sys_dir c on b.dircode = c.code
+            <where>
+                c.name = '鏁板瓧姝e皠褰卞儚鍥�' and b.type in ('img', 'tif', 'tiff')
+                <if test="null != code">
+                    and b.dircode like #{code}
+                </if>
+            </where>
+        )
+        union all
+        (select '鍊炬枩鎽勫奖妯″瀷' "m1", 'area' "m2", 0 "count", cast( coalesce(sum(b.area), 0) as decimal(20, 2) ) "area", 0 "len"
+            from lf.sys_meta b
+            <where>
+                b.type = 'osgb'
+                <if test="null != code">
+                    and b.dircode like #{code}
+                </if>
+            </where>
+        )
+        union all
+        (select '婵�鍏夌偣浜戞ā鍨�' "m1", 'area' "m2", 0 "count", cast( coalesce(sum(b.area), 0) as decimal(20, 2) ) "area", 0 "len"
+            from lf.sys_meta b
+            <where>
+                b.type in ('las', 'laz')
+                <if test="null != code">
+                    and b.dircode like #{code}
+                </if>
+            </where>
+        )
+        union all
+        (select '绠$嚎闀垮害' "m1", 'len' "m2", 0 "count", 0 "area",
+                cast( coalesce(sum( ST_Length( ST_GeographyFromText( ST_AsText(geom) ) ) ) / 1000, 0) as decimal(20, 2) ) "len"
+            from bs.m_pipeline b
+            <where>
+                <if test="null != code">
+                    b.dirid like #{code}
+                </if>
+            </where>
+        )
+        union all
+        (select '鍕樻帰鐐�' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.s_explorationpoint b
+            <where>
+                <if test="null != code">
+                    b.dirid like #{code}
+                </if>
+            </where>
+        )
+        union all
+        (select '鍕樺療宸ョ偣' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.s_surveyworksite b
+            <where>
+                <if test="null != code">
+                    b.dirid like #{code}
+                </if>
+            </where>
+        )
+        union all
+        (select '鍕樺療鎶ュ憡' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.s_explorationpoint b
+            inner join lf.sys_attach c on b.eventid = c.tab_guid
+            <where>
+                <if test="null != code">
+                    b.dirid like #{code}
+                </if>
+            </where>
+        )
+        union all
+        (select '涓夌淮鍦拌川妯″瀷' "m1", 'area' "m2", 0 "count", cast( coalesce(sum(b.area), 0) as decimal(20, 2) ) "area", 0 "len" from lf.sys_meta b
+            <where>
+                b.type in ('fbx', 'ifc')
+                <if test="null != code">
+                    and b.dircode like #{code}
+                </if>
+            </where>
+        )
+        union all
+        (select '鍦扮伨鐐�' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bd.b_geologic_hazard b
+            <where>
+                <if test="null != code">
+                    b.dirid like #{code}
+                </if>
+            </where>
+        )
+        union all
+        (select '宕╁' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.g_collapse b
+            <where>
+                <if test="null != code">
+                    b.dirid like #{code}
+                </if>
+            </where>
+        )
+        union all
+        (select '娉ョ煶娴�' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.g_debrisflow b
+            <where>
+                <if test="null != code">
+                    b.dirid like #{code}
+                </if>
+            </where>
+        )
+        union all
+        (select '鍦伴潰濉岄櫡' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.g_ground_collapse b
+            <where>
+                <if test="null != code">
+                    b.dirid like #{code}
+                </if>
+            </where>
+        )
+        union all
+        (select '楂橀櫋杈瑰潯' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.g_highandsteep_slope b
+            <where>
+                <if test="null != code">
+                    b.dirid like #{code}
+                </if>
+            </where>
+        )
+        union all
+        (select '婊戝潯' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.g_landslide b
+            <where>
+                <if test="null != code">
+                    b.dirid like #{code}
+                </if>
+            </where>
+        )
+        union all
+        (select '涓嶇ǔ瀹氭枩鍧�' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.g_unstable_slope b
+            <where>
+                <if test="null != code">
+                    b.dirid like #{code}
+                </if>
+            </where>
+        )
+        union all
+        (select '姘存瘉' "m1", 'count' "m2", count(*), 0 "area", 0 "len" from bs.g_water_damage b
+            <where>
+                <if test="null != code">
+                    b.dirid like #{code}
+                </if>
+            </where>
+        );
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.3