|
|
@@ -0,0 +1,172 @@
|
|
|
+<?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="com.siwei.apply.mapper.GongdiJihuaMapper">
|
|
|
+
|
|
|
+ <resultMap id="gongdiJihuaMap" type="com.siwei.apply.domain.GongdiJihua">
|
|
|
+ <id column="gid" property="gid"/>
|
|
|
+ <result column="fid" property="fid"/>
|
|
|
+ <result column="mj_pfm" property="mjPfm"/>
|
|
|
+ <result column="mj_mu" property="mjMu"/>
|
|
|
+ <result column="xmmc" property="xmmc"/>
|
|
|
+ <result column="tdyt" property="tdyt"/>
|
|
|
+ <result column="gyfs" property="gyfs"/>
|
|
|
+ <result column="gysj" property="gysj"/>
|
|
|
+ <result column="bz" property="bz"/>
|
|
|
+ <result column="geom" property="geom"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <insert id="add" parameterType="com.siwei.apply.domain.GongdiJihua">
|
|
|
+ INSERT INTO vector.gj_gongdi_jihua (fid, mj_pfm, mj_mu, xmmc, tdyt, gyfs, gysj, bz, geom)
|
|
|
+ VALUES (#{fid}, #{mjPfm}, #{mjMu}, #{xmmc}, #{tdyt}, #{gyfs}, #{gysj}, #{bz}, ST_GeomFromEWKT(#{geom}))
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <select id="get" resultMap="gongdiJihuaMap">
|
|
|
+ SELECT gid, fid, mj_pfm, mj_mu, xmmc, tdyt, gyfs, gysj, bz, ST_AsEWKT(geom) as geom
|
|
|
+ FROM vector.gj_gongdi_jihua
|
|
|
+ WHERE gid = #{gid}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getList" parameterType="com.siwei.apply.domain.vo.GongdiJihuaFilterVo" resultMap="gongdiJihuaMap">
|
|
|
+ SELECT gid, fid, mj_pfm, mj_mu, xmmc, tdyt, gyfs, gysj, bz, ST_AsEWKT(geom) as geom
|
|
|
+ FROM vector.gj_gongdi_jihua
|
|
|
+ <where>
|
|
|
+ <if test="xmmc != null and xmmc != ''">
|
|
|
+ AND xmmc LIKE CONCAT('%', #{xmmc}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="tdyt != null and tdyt != ''">
|
|
|
+ AND tdyt = #{tdyt}
|
|
|
+ </if>
|
|
|
+ <if test="gyfs != null and gyfs != ''">
|
|
|
+ AND gyfs = #{gyfs}
|
|
|
+ </if>
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
+ AND gysj >= #{startDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
+ AND gysj <= #{endDate}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ORDER BY gid DESC
|
|
|
+ LIMIT #{pageSize} OFFSET #{offset}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getCount" parameterType="com.siwei.apply.domain.vo.GongdiJihuaFilterVo" resultType="int">
|
|
|
+ SELECT COUNT(*)
|
|
|
+ FROM vector.gj_gongdi_jihua
|
|
|
+ <where>
|
|
|
+ <if test="xmmc != null and xmmc != ''">
|
|
|
+ AND xmmc LIKE CONCAT('%', #{xmmc}, '%')
|
|
|
+ </if>
|
|
|
+ <if test="tdyt != null and tdyt != ''">
|
|
|
+ AND tdyt = #{tdyt}
|
|
|
+ </if>
|
|
|
+ <if test="gyfs != null and gyfs != ''">
|
|
|
+ AND gyfs = #{gyfs}
|
|
|
+ </if>
|
|
|
+ <if test="startDate != null and startDate != ''">
|
|
|
+ AND gysj >= #{startDate}
|
|
|
+ </if>
|
|
|
+ <if test="endDate != null and endDate != ''">
|
|
|
+ AND gysj <= #{endDate}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <update id="update" parameterType="com.siwei.apply.domain.GongdiJihua">
|
|
|
+ UPDATE vector.gj_gongdi_jihua
|
|
|
+ <set>
|
|
|
+ <if test="fid != null">fid = #{fid},</if>
|
|
|
+ <if test="mjPfm != null">mj_pfm = #{mjPfm},</if>
|
|
|
+ <if test="mjMu != null">mj_mu = #{mjMu},</if>
|
|
|
+ <if test="xmmc != null">xmmc = #{xmmc},</if>
|
|
|
+ <if test="tdyt != null">tdyt = #{tdyt},</if>
|
|
|
+ <if test="gyfs != null">gyfs = #{gyfs},</if>
|
|
|
+ <if test="gysj != null">gysj = #{gysj},</if>
|
|
|
+ <if test="bz != null">bz = #{bz},</if>
|
|
|
+ <if test="geom != null">geom = ST_GeomFromEWKT(#{geom}),</if>
|
|
|
+ </set>
|
|
|
+ WHERE gid = #{gid}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <delete id="batchDelete">
|
|
|
+ DELETE FROM vector.gj_gongdi_jihua
|
|
|
+ WHERE gid IN
|
|
|
+ <foreach collection="gids" item="gid" open="(" separator="," close=")">
|
|
|
+ #{gid}
|
|
|
+ </foreach>
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <select id="getByGeomIntersects" resultMap="gongdiJihuaMap">
|
|
|
+ SELECT gid, fid, mj_pfm, mj_mu, xmmc, tdyt, gyfs, gysj, bz, ST_AsEWKT(geom) as geom
|
|
|
+ FROM vector.gj_gongdi_jihua
|
|
|
+ WHERE public.ST_Intersects(geom, public.ST_GeomFromEWKT(#{ewkt}))
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getPlanSummaryByTimeRange" resultType="map">
|
|
|
+ SELECT
|
|
|
+ COALESCE(SUM(mj_pfm), 0) AS planarea,
|
|
|
+ COALESCE(SUM(mj_mu), 0) AS planmu,
|
|
|
+ COUNT(*) AS plancount,
|
|
|
+ COALESCE(SUM(CASE WHEN gyfs = '出让' THEN 1 ELSE 0 END), 0) AS plantransfer,
|
|
|
+ COALESCE(SUM(CASE WHEN gyfs = '划拨' THEN 1 ELSE 0 END), 0) AS planallocation,
|
|
|
+ COALESCE(SUM(CASE WHEN gyfs IS NULL OR gyfs NOT IN ('出让', '划拨') THEN 1 ELSE 0 END), 0) AS planother
|
|
|
+ FROM vector.gj_gongdi_jihua
|
|
|
+ <where>
|
|
|
+ <if test="startTime != null and startTime != ''">
|
|
|
+ AND gysj >= #{startTime}::date
|
|
|
+ </if>
|
|
|
+ <if test="endTime != null and endTime != ''">
|
|
|
+ AND gysj <= #{endTime}::date
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getPlanStatsByLandType" resultType="map">
|
|
|
+ SELECT
|
|
|
+ COALESCE(tdyt, '未知') AS category,
|
|
|
+ COALESCE(SUM(mj_pfm), 0) AS planarea,
|
|
|
+ COALESCE(SUM(mj_mu), 0) AS planmu,
|
|
|
+ COUNT(*) AS plancount,
|
|
|
+ COALESCE(SUM(CASE WHEN gyfs = '出让' THEN 1 ELSE 0 END), 0) AS plantransfer,
|
|
|
+ COALESCE(SUM(CASE WHEN gyfs = '划拨' THEN 1 ELSE 0 END), 0) AS planallocation,
|
|
|
+ COALESCE(SUM(CASE WHEN gyfs IS NULL OR gyfs NOT IN ('出让', '划拨') THEN 1 ELSE 0 END), 0) AS planother,
|
|
|
+ '0%' AS supplyrate
|
|
|
+ FROM vector.gj_gongdi_jihua
|
|
|
+ <where>
|
|
|
+ <if test="startTime != null and startTime != ''">
|
|
|
+ AND gysj >= #{startTime}::date
|
|
|
+ </if>
|
|
|
+ <if test="endTime != null and endTime != ''">
|
|
|
+ AND gysj <= #{endTime}::date
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY tdyt
|
|
|
+ ORDER BY planarea DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getPlanStatsBySupplyMode" resultType="map">
|
|
|
+ SELECT
|
|
|
+ COALESCE(gyfs, '未知') AS category,
|
|
|
+ COALESCE(SUM(mj_pfm), 0) AS planarea,
|
|
|
+ COALESCE(SUM(mj_mu), 0) AS planmu,
|
|
|
+ COUNT(*) AS plancount,
|
|
|
+ COALESCE(SUM(CASE WHEN gyfs = '出让' THEN 1 ELSE 0 END), 0) AS plantransfer,
|
|
|
+ COALESCE(SUM(CASE WHEN gyfs = '划拨' THEN 1 ELSE 0 END), 0) AS planallocation,
|
|
|
+ COALESCE(SUM(CASE WHEN gyfs IS NULL OR gyfs NOT IN ('出让', '划拨') THEN 1 ELSE 0 END), 0) AS planother,
|
|
|
+ '0%' AS supplyrate
|
|
|
+ FROM vector.gj_gongdi_jihua
|
|
|
+ <where>
|
|
|
+ <if test="startTime != null and startTime != ''">
|
|
|
+ AND gysj >= #{startTime}::date
|
|
|
+ </if>
|
|
|
+ <if test="endTime != null and endTime != ''">
|
|
|
+ AND gysj <= #{endTime}::date
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ GROUP BY gyfs
|
|
|
+ ORDER BY planarea DESC
|
|
|
+ </select>
|
|
|
+
|
|
|
+</mapper>
|