tangzy
2021-09-13 139987154fa26282b30cf237c13d999f5f5547a2
src/main/java/org/springblade/modules/mountainrain/mapper/MountainrainMapper.xml
@@ -266,100 +266,164 @@
    </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,
            a.drp1,
            b.drp3,
            c.drp6,
            isnull(d.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
        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 drp3,
        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 drp6,
        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
        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} AND strd.STCD IN (${code})
        GROUP BY STCD
        ) d on d.STCD=a.STCD
        LEFT JOIN (
        SELECT
        id,
        cenconding,
        crainfall,
        township,
        village,
        village_group,
        dj,
        bw,
        county,
        fyear,
        tyear,
        oyear,
        gohour,
        gthour,
        gshour,
        imohour,
        imthour,
        imshour
        FROM
        blade_mountain
        ) cs ON cs.cenconding= a.STCD
        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})
          AND datename(HOUR,TM) = 8
        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>