<?xml version="1.0" encoding="UTF-8"?>
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<mapper namespace="org.springblade.modules.floodinundation.mapper.FloodinundationMapper">
|
|
<!-- 通用查询映射结果 -->
|
<resultMap id="floodinundationResultMap" type="org.springblade.modules.floodinundation.entity.floodinundation">
|
<result column="id" property="id"/>
|
<result column="wcode" property="wcode"/>
|
<result column="district" property="district"/>
|
<result column="township" property="township"/>
|
<result column="village" property="village"/>
|
<result column="villagegroup" property="villagegroup"/>
|
<result column="dj" property="dj"/>
|
<result column="bw" property="bw"/>
|
<result column="totalp" property="totalp"/>
|
<result column="disaster" property="disaster"/>
|
<result column="fpopulation" property="fpopulation"/>
|
<result column="fhouseholds" property="fhouseholds"/>
|
<result column="tTill" property="ftill"/>
|
<result column="tpopulation" property="tpopulation"/>
|
<result column="thouseholds" property="thouseholds"/>
|
<result column="tTill" property="ttill"/>
|
<result column="ftpopulation" property="ftpopulation"/>
|
<result column="fthouseholds" property="fthouseholds"/>
|
<result column="fttill" property="fttill"/>
|
<result column="origin" property="origin"/>
|
<result column="z" property="z"/>
|
<result column="hcode" property="hcode"/>
|
</resultMap>
|
|
|
<resultMap id="floodinundationCountMap" type="org.springblade.modules.floodinundation.vo.FloodinundationsVO">
|
<result column="district" property="district"/>
|
<result column="c" property="c"/>
|
<result column="b" property="b"/>
|
</resultMap>
|
|
<resultMap id="floodinundationCountMapS" type="org.springblade.modules.floodinundation.vo.FloodinundationsVOS">
|
<result column="count" property="count"/>
|
</resultMap>
|
|
|
<resultMap id="floodinundationCountMapss" type="org.springblade.modules.floodinundation.vo.FloodinundationVO">
|
<result column="id" property="id"/>
|
<result column="wcode" property="wcode"/>
|
<result column="district" property="district"/>
|
<result column="township" property="township"/>
|
<result column="village" property="village"/>
|
<result column="villagegroup" property="villagegroup"/>
|
<result column="dj" property="dj"/>
|
<result column="bw" property="bw"/>
|
<result column="totalp" property="totalp"/>
|
<result column="disaster" property="disaster"/>
|
<result column="fpopulation" property="fpopulation"/>
|
<result column="fhouseholds" property="fhouseholds"/>
|
<result column="ftill" property="ftill"/>
|
<result column="tpopulation" property="tpopulation"/>
|
<result column="thouseholds" property="thouseholds"/>
|
<result column="tTill" property="ttill"/>
|
<result column="ftpopulation" property="ftpopulation"/>
|
<result column="fthouseholds" property="fthouseholds"/>
|
<result column="fttill" property="fttill"/>
|
<result column="origin" property="origin"/>
|
<result column="z" property="z"/>
|
<result column="hcode" property="hcode"/>
|
</resultMap>
|
|
<select id="selectfloodinundationPage" resultMap="floodinundationCountMapss">
|
select f.id,f.wcode,f.district,f.township,f.village,f.villagegroup,cast(f.dj as decimal(18,6)) as dj,cast(f.bw
|
as decimal(18,6)) as bw,f.totalp,f.disaster,f.fpopulation,f.fhouseholds,f.ftill,f.tpopulation,f.thouseholds
|
,f.tTill,f.ftpopulation,f.fthouseholds,f.fttill,f.origin,f.z,r.riverway as hcode from blade_floodinundation f
|
LEFT JOIN riverway r ON r.river_code=f.hcode
|
where 1=1
|
<if test="floodinundationVO.village!=null and floodinundationVO.village!=''">
|
and f.village like '%' + #{floodinundationVO.village} + '%'
|
</if>
|
<if test="floodinundationVO.district!=null and floodinundationVO.district!=''">
|
and f.district like '%' + #{floodinundationVO.district} + '%'
|
</if>
|
<if test="floodinundationVO.villagegroup!=null and floodinundationVO.villagegroup!=''">
|
and f.villagegroup like '%' + #{floodinundationVO.villagegroup} + '%'
|
</if>
|
<if test="floodinundationVO.hcode!=null and floodinundationVO.hcode!=''">
|
and f.hcode like '%' + #{floodinundationVO.hcode} + '%'
|
</if>
|
ORDER BY f.hcode,origin asc
|
</select>
|
|
<select id="selectfId" resultMap="floodinundationCountMapss">
|
select f.id,f.wcode,f.district,f.township,f.village,f.villagegroup,cast(f.dj as decimal(18,6)) as dj,cast(f.bw as decimal(18,6)) as bw,f.totalp,f.disaster,f.fpopulation,f.fhouseholds,f.ftill,f.tpopulation,f.thouseholds
|
,f.tTill,f.ftpopulation,f.fthouseholds,f.fttill,f.origin,f.z,r.riverway as hcode from blade_floodinundation f LEFT JOIN riverway r ON r.river_code=f.hcode
|
where f.id=#{id}
|
</select>
|
|
<select id="selectInfo" resultType="int">
|
SELECT COUNT(*) as number FROM blade_floodinundation WHERE wcode=#{pid}
|
</select>
|
<delete id="deleteInfo">
|
delete from blade_floodinundation WHERE wcode=#{pid}
|
</delete>
|
|
<select id="selectNoticeList" resultMap="floodinundationResultMap">
|
select * from blade_floodinundation
|
<if test="query!=null">
|
where township like '%' + #{query} + '%'
|
or village like '%' + #{query} + '%'
|
or villagegroup like '%' + #{query} + '%'
|
</if>
|
</select>
|
|
<select id="selectC" resultType="java.util.HashMap">
|
SELECT
|
cs2.villagegroup,
|
cs2.village,
|
cs2.township,
|
cs2.river_type,
|
cs2.river_name,
|
cs2.origin,
|
ISNULL( CS2.hz,0) as hz,
|
CS2.hcode,
|
CS2.gl_code,
|
CS2.dj,
|
CS2.district,
|
CS2.default_smx,
|
ISNULL(CS2.bzgc,0) as bzgc,
|
CS2.bw,
|
cs2.fpopulation,
|
cs2.fhouseholds,
|
cs2.ftill,
|
cs2.tpopulation,
|
cs2.thouseholds,
|
cs2.tTill,
|
cs2.ftpopulation,
|
cs2.fthouseholds,
|
cs2.fttill,
|
b.STNM,
|
cs1.Z,
|
cs.TM
|
FROM
|
(
|
SELECT
|
A.STCD,
|
MAX ( A.TM ) TM
|
FROM
|
( SELECT STCD, TM, Z FROM ST_RIVER_R where TM >=#{dateEnd} AND TM<=#{times}) AS A
|
INNER JOIN ( SELECT f.district,f.village,f.villagegroup,f.township,
|
f.dj,f.fpopulation,f.fhouseholds,f.ftill,f.tpopulation,f.thouseholds,f.tTill,f.ftpopulation,f.fthouseholds,f.fttill,f.bw,f.origin,f.hcode,f.z
|
as hz,r.gl_code,r.river_name,r.river_type,r.default_smx,w.bzgc FROM blade_floodinundation f LEFT JOIN riverway r
|
on r.river_code=f.hcode LEFT JOIN waterline w on w.smxcode=r.default_smx) s ON A.STCD = s.gl_code
|
|
GROUP BY
|
A.STCD
|
) cs
|
INNER JOIN ( SELECT STCD, TM, Z FROM ST_RIVER_R where TM >=#{dateEnd} AND TM<=#{times}) cs1 ON cs.STCD =
|
cs1.STCD
|
AND cs.TM = cs1.TM
|
INNER JOIN ( SELECT f.district,f.village,f.villagegroup,f.township,
|
f.dj,f.fpopulation,f.fhouseholds,f.ftill,f.tpopulation,f.thouseholds,f.tTill,f.ftpopulation,f.fthouseholds,f.fttill,f.bw,f.origin,f.hcode,f.z
|
AS hz,r.gl_code,r.river_name,r.river_type,r.default_smx,w.bzgc FROM blade_floodinundation f LEFT JOIN riverway r
|
on r.river_code=f.hcode LEFT JOIN waterline w on w.smxcode=r.default_smx) cs2 ON cs.STCD = cs2.gl_code
|
LEFT JOIN dbo.ST_STBPRP_B b on b.STCD=cs2.gl_code
|
<if test="1 == code">
|
WHERE cs2.river_type='主要河流'
|
</if>
|
<if test="2 == code">
|
WHERE cs2.river_type='中小河流'
|
</if>
|
</select>
|
|
<!--13库-->
|
<select id="selectCS" resultType="java.util.HashMap">
|
SELECT
|
cs2.villagegroup,
|
cs2.village,
|
cs2.township,
|
cs2.river_type,
|
cs2.river_name,
|
cs2.origin,
|
ISNULL( cs2.hz,0) as hz,
|
cs2.hcode,
|
cs2.gl_code,
|
cs2.dj,
|
cs2.district,
|
cs2.default_smx,
|
ISNULL(cs2.bzgc,0) as bzgc,
|
cs2.bw,
|
cs2.fpopulation,
|
cs2.fhouseholds,
|
cs2.ftill,
|
cs2.tpopulation,
|
cs2.thouseholds,
|
cs2.tTill,
|
cs2.ftpopulation,
|
cs2.fthouseholds,
|
cs2.fttill,
|
b.STNM,
|
cs1.Z,
|
cs.TM
|
FROM
|
(
|
SELECT
|
A.STCD,
|
MAX ( A.TM ) TM
|
FROM
|
( SELECT STCD, TM, Z FROM ST_RIVER_R where TM >=#{dateEnd} AND TM<=#{times}) AS A
|
GROUP BY
|
A.STCD
|
) cs
|
INNER JOIN ( SELECT STCD, TM, Z FROM ST_RIVER_R where TM >=#{dateEnd} AND TM<=#{times}) cs1 ON cs.STCD =
|
cs1.STCD
|
AND cs.TM = cs1.TM
|
INNER JOIN ( SELECT f.district,f.village,f.villagegroup,f.township,
|
f.dj,f.fpopulation,f.fhouseholds,f.ftill,f.tpopulation,f.thouseholds,f.tTill,f.ftpopulation,f.fthouseholds,f.fttill,f.bw,f.origin,f.hcode,f.z
|
AS hz,r.gl_code,r.river_name,r.river_type,r.default_smx,w.bzgc FROM blade_floodinundation f
|
LEFT JOIN riverway r on r.river_code=f.hcode
|
LEFT JOIN waterline w on w.smxcode=r.default_smx) cs2 ON cs.STCD = cs2.gl_code
|
INNER JOIN dbo.ST_STBPRP_B b on b.STCD=cs2.gl_code
|
</select>
|
</mapper>
|