From bc76e975aae3837eae625a2e3ffff7d02a5fc3f3 Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Mon, 13 Sep 2021 17:27:24 +0800
Subject: [PATCH] 1.山洪

---
 src/main/java/org/springblade/modules/mountainrain/mapper/MountainrainMapper.xml |  392 +++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 275 insertions(+), 117 deletions(-)

diff --git a/src/main/java/org/springblade/modules/mountainrain/mapper/MountainrainMapper.xml b/src/main/java/org/springblade/modules/mountainrain/mapper/MountainrainMapper.xml
index fd9bfd4..27d9636 100644
--- a/src/main/java/org/springblade/modules/mountainrain/mapper/MountainrainMapper.xml
+++ b/src/main/java/org/springblade/modules/mountainrain/mapper/MountainrainMapper.xml
@@ -106,7 +106,8 @@
 
 
     <select id="selectMountainrainPage" resultMap="mountainrainResultMap">
-        select * from blade_mountainrain
+        select *
+        from blade_mountainrain
     </select>
     <select id="selectNoticePage" resultMap="ResultMap">
         SELECT
@@ -132,139 +133,296 @@
         dbo.blade_mountain mr
         where 1=1
         <if test="mountainrainSSVO.crainfall!=null">
-            and mr.crainfall like  '%' +  #{mountainrainSSVO.crainfall} + '%'
+            and mr.crainfall like '%' + #{mountainrainSSVO.crainfall} + '%'
         </if>
         <if test="mountainrainSSVO.arainfall!=null">
-            and mr.arainfall like  '%' +  #{mountainrainSSVO.arainfall} + '%'
+            and mr.arainfall like '%' + #{mountainrainSSVO.arainfall} + '%'
         </if>
         <if test="mountainrainSSVO.township!=null">
-            and mr.township like  '%' +  #{mountainrainSSVO.township} + '%'
+            and mr.township like '%' + #{mountainrainSSVO.township} + '%'
         </if>
         <if test="mountainrainSSVO.village_group!=null">
-            and mr.village_group like  '%' +  #{mountainrainSSVO.village_group} + '%'
+            and mr.village_group like '%' + #{mountainrainSSVO.village_group} + '%'
         </if>
         <if test="mountainrainSSVO.county!=null">
-            and mr.county like  '%' +  #{mountainrainSSVO.county} + '%'
+            and mr.county like '%' + #{mountainrainSSVO.county} + '%'
         </if>
         <if test="mountainrainSSVO.village!=null">
-            and mr.village like  '%' +  #{mountainrainSSVO.village} + '%'
+            and mr.village like '%' + #{mountainrainSSVO.village} + '%'
         </if>
         ORDER BY mr.cenconding
     </select>
     <select id="selectInfo" resultMap="ResultMap">
-        SELECT
-            mr.id,
-            mr.cenconding,
-            mr.aconding,
-            mr.township,
-            mr.village,
-            mr.village_group as village_group,
-            mr.dj,
-            mr.bw,
-            mr.fyear,
-            mr.tyear,
-            mr.oyear,
-            mr.county,
-            mr.crainfall,
-            mr.arainfall,
-            isnull(mr.gohour,0) gohour,
-            isnull(mr.gthour,0) gthour,
-            isnull(mr.gshour,0) gshour,
-            isnull(mr.imohour,0) imohour,
-            isnull(mr.imthour,0) imthour,
-            isnull(mr.imshour,0) imshour
-        FROM
-            dbo.blade_mountain mr
-        where mr.id=#{id}
+        SELECT mr.id,
+               mr.cenconding,
+               mr.aconding,
+               mr.township,
+               mr.village,
+               mr.village_group as   village_group,
+               mr.dj,
+               mr.bw,
+               mr.fyear,
+               mr.tyear,
+               mr.oyear,
+               mr.county,
+               mr.crainfall,
+               mr.arainfall,
+               isnull(mr.gohour, 0)  gohour,
+               isnull(mr.gthour, 0)  gthour,
+               isnull(mr.gshour, 0)  gshour,
+               isnull(mr.imohour, 0) imohour,
+               isnull(mr.imthour, 0) imthour,
+               isnull(mr.imshour, 0) imshour
+        FROM dbo.blade_mountain mr
+        where mr.id = #{id}
     </select>
 
 
     <select id="selectcInfos" resultMap="mountainrainResultMapcInfo">
-        SELECT
-            cs.id,
-            cs1.c,
-            cs.cenconding,
-            cs.crainfall,
-            isnull(cs.gohour,0) gohour,
-            isnull(cs.gthour,0) gthour,
-            isnull(cs.gshour,0) gshour,
-            isnull(cs.imohour,0) imohour,
-            isnull(cs.imthour,0) imthour,
-            isnull(cs.imshour,0) imshour,
-            css.drp1,
-            cs2.drp3,
-            cs6.drp6,
-            isnull(csd.dyp,0) dyp,
-            cs.township,
-            cs.village,
-            cs.village_group,
-            cs.dj,
-            cs.bw,
-            cs.county,
-            isnull(cs.fyear,0) as fyear ,
-            isnull(cs.tyear,0) as tyear,
-            isnull(cs.oyear,0) as oyear
-        FROM
-            ( SELECT id,cenconding,crainfall,township, village, village_group, dj, bw,county,fyear,tyear,oyear,gohour,gthour,gshour,imohour,imthour,imshour FROM blade_mountain ) cs
-                INNER JOIN (
-                SELECT
-                    ISNULL( COUNT ( * ), 0 ) AS c,
-                    STCD
-                FROM
-                    dbo.ST_PPTN_R
-                WHERE
-                    TM &gt;=#{dateEnd24}
-                  AND TM &lt;=#{times}
-                GROUP BY
-                    STCD
-            ) cs1 ON cs.cenconding = cs1.STCD
-                INNER JOIN (
-                SELECT
-                    ISNULL( SUM ( str.DRP ), 0 ) AS drp1,
-                    STCD
-                FROM
-                    dbo.ST_PPTN_R str
-                WHERE
-                    str.TM &gt;=#{dateEnd1}
-                  AND str.TM &lt;=#{times}
-                GROUP BY
-                    STCD
-            ) css ON css.STCD = cs.cenconding
-                FULL JOIN (
-                SELECT
-                    ISNULL( SUM ( s.DRP ), 0 ) AS drp3,
-                    STCD
-                FROM
-                    dbo.ST_PPTN_R s
-                WHERE
-                    s.TM &gt;=#{dateEnd3}
-                  AND s.TM &lt;=#{times}
-                GROUP BY
-                    STCD
-            ) cs2 ON cs2.STCD = cs.cenconding
-                FULL JOIN (
-                SELECT
-                    ISNULL( SUM ( strs.DRP ), 0 ) AS drp6,
-                    STCD
-                FROM
-                    dbo.ST_PPTN_R strs
-                WHERE
-                    strs.TM &gt;=#{dateEnd6}
-                  AND strs.TM &lt;=#{times}
-                GROUP BY
-                    STCD
-            ) cs6 ON cs6.STCD = cs.cenconding
-                FULL JOIN (
-                SELECT
-                    SUM( strd.DRP ) AS dyp,STCD
-                FROM
-                    dbo.ST_PPTN_R strd
-                WHERE
-                    strd.TM &gt;=#{timess}
-                  AND strd.TM &lt;=#{times}
-                GROUP BY STCD
-            ) csd on csd.STCD=cs.cenconding
-        WHERE
-            cs.cenconding IS NOT NULL order by id
+        SELECT cs.id,
+               cs.cenconding,
+               cs.crainfall,
+               isnull(cs.gohour, 0)   gohour,
+               isnull(cs.gthour, 0)   gthour,
+               isnull(cs.gshour, 0)   gshour,
+               isnull(cs.imohour, 0)  imohour,
+               isnull(cs.imthour, 0)  imthour,
+               isnull(cs.imshour, 0)  imshour,
+               css.drp1,
+               cs2.drp3,
+               cs6.drp6,
+               isnull(csd.dyp, 0)     dyp,
+               cs.township,
+               cs.village,
+               cs.village_group,
+               cs.dj,
+               cs.bw,
+               cs.county,
+               isnull(cs.fyear, 0) as fyear,
+               isnull(cs.tyear, 0) as tyear,
+               isnull(cs.oyear, 0) as oyear
+        FROM (SELECT id,
+                     cenconding,
+                     crainfall,
+                     township,
+                     village,
+                     village_group,
+                     dj,
+                     bw,
+                     county,
+                     fyear,
+                     tyear,
+                     oyear,
+                     gohour,
+                     gthour,
+                     gshour,
+                     imohour,
+                     imthour,
+                     imshour
+              FROM blade_mountain) cs
+                 INNER JOIN (
+            SELECT ISNULL(SUM(str.DRP), 0) AS drp1,
+                   STCD
+            FROM dbo.ST_PPTN_R str
+            WHERE str.TM &gt; #{dateEnd1}
+              AND str.TM &lt;= #{times}
+            GROUP BY STCD
+        ) css ON css.STCD = cs.cenconding
+                 FULL JOIN (
+            SELECT ISNULL(SUM(s.DRP), 0) AS drp3,
+                   STCD
+            FROM dbo.ST_PPTN_R s
+            WHERE s.TM &gt; #{dateEnd3}
+              AND s.TM &lt;= #{times}
+            GROUP BY STCD
+        ) cs2 ON cs2.STCD = cs.cenconding
+                 FULL JOIN (
+            SELECT ISNULL(SUM(strs.DRP), 0) AS drp6,
+                   STCD
+            FROM dbo.ST_PPTN_R strs
+            WHERE strs.TM &gt; #{dateEnd6}
+              AND strs.TM &lt;= #{times}
+            GROUP BY STCD
+        ) cs6 ON cs6.STCD = cs.cenconding
+                 FULL JOIN (
+            SELECT SUM(strd.DRP) AS dyp,
+                   STCD
+            FROM dbo.ST_PPTN_R strd
+            WHERE strd.TM &gt; #{timess}
+              AND strd.TM &lt;= #{times}
+            GROUP BY STCD
+        ) csd on csd.STCD = cs.cenconding
     </select>
+
+
+    <select id="selectCode" resultType="java.lang.String">
+        SELECT stuff((
+            SELECT ',' + CONVERT(VARCHAR (25), m.cenconding)
+            FROM dbo.blade_mountain m INNER JOIN ST_STBPRP_B s ON  s.STCD=m.cenconding  GROUP BY m.cenconding   FOR XML PATH ('')),
+		1,
+		1,
+	''
+	) AS siteids
+    </select>
+
+    <select id="Mountains" resultMap="mountainrainResultMapcInfo">
+        SELECT cs.id,
+               cs.cenconding,
+               cs.crainfall,
+               isnull(cs.gohour, 0)     gohour,
+               isnull(cs.gthour, 0)     gthour,
+               isnull(cs.gshour, 0)     gshour,
+               isnull(cs.imohour, 0)    imohour,
+               isnull(cs.imthour, 0)    imthour,
+               isnull(cs.imshour, 0)    imshour,
+               isnull(cs.gohours, 0)    gohours,
+               isnull(cs.gthours, 0)    gthours,
+               a.drp1,
+               b.drp2,
+               c.drp3,
+               cs.township,
+               cs.village,
+               cs.village_group,
+               cs.dj,
+               cs.bw,
+               cs.county,
+               isnull(cs.fyear, 0)   as fyear,
+               isnull(cs.tyear, 0)   as tyear,
+               isnull(cs.oyear, 0)   as oyear,
+               isnull(so.soilval, 0) as soilval
+        FROM (
+                 SELECT ISNULL(SUM(str.DRP), 0) AS drp1,
+                        STCD
+                 FROM dbo.ST_PPTN_R str
+                 WHERE str.TM &gt; #{dateEnd1}
+                   AND str.TM &lt;= #{times}
+                   AND str.STCD IN (${code})
+                 GROUP BY str.STCD
+             ) a
+                 FULL JOIN (
+            SELECT ISNULL(SUM(s.DRP), 0) AS drp2,
+                   STCD
+            FROM dbo.ST_PPTN_R s
+            WHERE s.TM &gt; #{dateEnd3}
+              AND s.TM &lt;= #{times}
+              AND s.STCD IN (${code})
+            GROUP BY s.STCD
+        ) b ON a.STCD = b.STCD
+                 FULL JOIN (
+            SELECT ISNULL(SUM(strs.DRP), 0) AS drp3,
+                   STCD
+            FROM dbo.ST_PPTN_R strs
+            WHERE strs.TM &gt; #{dateEnd6}
+              AND strs.TM &lt;= #{times}
+              AND strs.STCD IN (${code})
+            GROUP BY STCD
+        ) c ON a.STCD = c.STCD
+                 LEFT JOIN (
+            SELECT id,
+                   cenconding,
+                   crainfall,
+                   township,
+                   village,
+                   village_group,
+                   dj,
+                   bw,
+                   county,
+                   fyear,
+                   tyear,
+                   oyear,
+                   gohour,
+                   gthour,
+                   gshour,
+                   imohour,
+                   imthour,
+                   imshour,
+                   gohours,
+                   gthours
+            FROM blade_mountain
+        ) cs ON cs.cenconding = a.STCD
+    </select>
+
+    <!--第一种预警-->
+    <select id="selecMone" resultType="java.util.Map">
+        SELECT cs.STCD,
+               cs.STNM,
+               cs.STLC,
+               cs.ADDVNM,
+               cs.RVNM,
+               cs.HNNM,
+               cs.LTTD,
+               cs.LGTD,
+               isnull(a.drp1, 0) as drp1
+            isnull(b.drp2,0) as drp2
+            isnull(c.drp3,0) as drp3
+        FROM (
+                 SELECT ISNULL(SUM(str.DRP), 0) AS drp1,
+                        STCD
+                 FROM dbo.ST_PPTN_R str
+                 WHERE str.TM &gt; #{dateEnd1}
+                   AND str.TM &lt;= #{times}
+                   AND str.STCD IN (${code})
+                 GROUP BY str.STCD
+             ) a
+                 FULL JOIN (
+            SELECT ISNULL(SUM(s.DRP), 0) AS drp2,
+                   STCD
+            FROM dbo.ST_PPTN_R s
+            WHERE s.TM &gt; #{dateEnd2}
+              AND s.TM &lt;= #{times}
+              AND s.STCD IN (${code})
+            GROUP BY s.STCD
+        ) b ON a.STCD = b.STCD
+                 FULL JOIN (
+            SELECT ISNULL(SUM(strs.DRP), 0) AS drp3,
+                   STCD
+            FROM dbo.ST_PPTN_R strs
+            WHERE strs.TM &gt; #{dateEnd3}
+              AND strs.TM &lt;= #{times}
+              AND strs.STCD IN (${code})
+            GROUP BY STCD
+        ) c ON a.STCD = c.STCD
+                 LEFT JOIN (
+            SELECT STCD,
+                   st.STNM,
+                   st.ADDVCD,
+                   st.STLC,
+                   st.LTTD,
+                   st.LGTD,
+                   st.RVNM,
+                   st.HNNM,
+                   ad.ADDVNM
+            FROM dbo.ST_STBPRP_B st
+                     INNER JOIN dbo.ST_ADDVCD_D ad ON ad.ADDVCD = st.ADDVCD
+        ) cs ON cs.STCD = a.STCD
+                 LEFT JOIN (
+            SELECT stcd, soilval
+            FROM sys_soleval
+        ) so ON so.stcd = a.STCD
+    </select>
+
+    <!--土壤湿度计算-->
+    <select id="selectMtwo" resultType="java.util.Map">
+        SELECT SUM
+                   (DRP) AS drp,
+               STCD
+        FROM dbo.ST_PPTN_R
+        WHERE TM &gt; #{time3}
+          AND TM &lt;= #{time}
+          AND STCD IN (${code})
+        GROUP BY STCD
+    </select>
+
+    <insert id="soleInster">
+        insert
+        sys_soleval(stcd,soilval) value (
+        #{stcd},
+        #{soilval}
+        )
+    </insert>
+
+    <delete id="soildel">
+        DELETE
+        FROM sys_soleval
+    </delete>
 </mapper>

--
Gitblit v1.9.3