| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406 |
- <?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.CadastreFileMapper">
- <resultMap id="cadastreFileMap" type="com.siwei.apply.domain.CadastreFile">
- <id column="id" property="id"/>
- <result column="name" property="name"/>
- <result column="upload_user" property="uploadUser"/>
- <result column="upload_time" property="uploadTime"/>
- <result column="file_path" property="filePath"/>
- <result column="proxy_path" property="proxyPath"/>
- <result column="unzip_path" property="unzipPath"/>
- <result column="file_type" property="fileType"/>
- <result column="storage" property="storage"/>
- <result column="status" property="status"/>
- <result column="read_status" property="readStatus"/>
- <result column="read_message" property="readMessage"/>
- <result column="file_storage_time" property="fileStorageTime"/>
- <result column="update_time" property="updateTime"/>
- <result column="file_size" property="fileSize"/>
- </resultMap>
- <sql id="Base_Column_List">
- id, name, upload_user, upload_time, file_path, proxy_path, unzip_path, file_type, storage, status, read_status, read_message, file_storage_time, update_time, file_size
- </sql>
- <insert id="add" parameterType="com.siwei.apply.domain.CadastreFile">
- INSERT INTO t_cadastre_file (
- id, name, upload_user, upload_time, file_path, proxy_path, unzip_path, file_type, storage, status, read_status, read_message, file_storage_time, update_time, file_size
- ) VALUES (
- #{id}, #{name}, #{uploadUser}, #{uploadTime}, #{filePath}, #{proxyPath}, #{unzipPath}, #{fileType}, #{storage}, #{status}, #{readStatus}, #{readMessage}, #{fileStorageTime}, #{updateTime}, #{fileSize}
- )
- </insert>
- <select id="get" resultMap="cadastreFileMap">
- SELECT <include refid="Base_Column_List"/>
- FROM t_cadastre_file
- WHERE id = #{id}
- </select>
- <update id="update" parameterType="com.siwei.apply.domain.CadastreFile">
- UPDATE t_cadastre_file
- <set>
- <if test="name != null">name = #{name},</if>
- <if test="uploadUser != null">upload_user = #{uploadUser},</if>
- <if test="uploadTime != null">upload_time = #{uploadTime},</if>
- <if test="filePath != null">file_path = #{filePath},</if>
- <if test="proxyPath != null">proxy_path = #{proxyPath},</if>
- <if test="unzipPath != null">unzip_path = #{unzipPath},</if>
- <if test="fileType != null">file_type = #{fileType},</if>
- <if test="storage != null">storage = #{storage},</if>
- <if test="status != null">status = #{status},</if>
- <if test="readStatus != null">read_status = #{readStatus},</if>
- <if test="readMessage != null">read_message = #{readMessage},</if>
- <if test="fileStorageTime != null">file_storage_time = #{fileStorageTime},</if>
- <if test="updateTime != null">update_time = #{updateTime},</if>
- <if test="fileSize != null">file_size = #{fileSize},</if>
- </set>
- WHERE id = #{id}
- </update>
- <delete id="delete">
- DELETE FROM t_cadastre_file WHERE id = #{id}
- </delete>
- <delete id="batchDelete">
- DELETE FROM t_cadastre_file
- WHERE id IN
- <foreach collection="ids" item="id" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <select id="getList" resultMap="cadastreFileMap">
- SELECT <include refid="Base_Column_List"/>
- FROM t_cadastre_file
- <where>
- <if test="name != null and name != ''">
- AND name LIKE CONCAT('%', #{name}, '%')
- </if>
- <if test="status != null and status != ''">
- AND status = #{status}
- </if>
- </where>
- </select>
- <select id="selectTableRowExcel" resultType="map">
- SELECT *
- FROM vector.${tableName}
- <where>
- <if test="bsmList != null and bsmList.size() > 0">
- AND bsm IN
- <foreach collection="bsmList" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="ywhList != null and ywhList.size() > 0">
- AND ywh IN
- <foreach collection="ywhList" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </where>
- </select>
- <select id="selectTableCollum" parameterType="String" resultType="String">
- select COLUMN_NAME FROM information_schema.COLUMNS
- WHERE
- table_schema = 'vector'
- AND TABLE_NAME = #{tableName}
- </select>
- <select id="selectTableCollumAndType" parameterType="String" resultType="map">
- select COLUMN_NAME, DATA_TYPE FROM information_schema.COLUMNS
- WHERE
- table_schema = 'vector'
- AND TABLE_NAME = #{tableName}
- </select>
- <select id="selectDistinctValueByField" parameterType="String" resultType="String">
- select distinct ${fieldName} FROM vector.${tableName}
- WHERE valid_flag = 0
- </select>
- <select id="selectAllTable" resultType="string">
- select table_name from information_schema.tables
- where table_schema = 'vector'
- </select>
- <select id="selectAllTableNoView" resultType="string">
- select table_name from information_schema.tables
- where table_schema = 'vector'
- </select>
- <insert id="insertTableData222">
- INSERT INTO ${tableName} (
- <foreach collection="tableDataMap" item="map" separator=",">
- <foreach collection="map.keySet()" item="key" separator=",">
- ${key}
- </foreach>
- </foreach>
- )
- VALUES (
- <foreach collection="tableDataMap" item="map" separator=",">
- <foreach collection="map.values()" item="value" separator=",">
- #{value}
- </foreach>
- </foreach>
- )
- </insert>
- <insert id="insertTableData">
- INSERT INTO vector.${tableName} (
- <foreach collection="data" index="key" item="value" separator=",">
- ${key}
- </foreach>
- )
- VALUES (
- <foreach collection="data" index="key" item="value" separator=",">
- <choose>
- <!-- 判断 geom 是否为空,并进行转换 -->
- <when test="key == 'geom' and value != null">
- public.st_transform(public.st_geomfromewkt(#{value}), #{shpDbSRID})
- </when>
- <otherwise>
- #{value}
- </otherwise>
- </choose>
- </foreach>
- )
- </insert>
- <insert id="batchInsertTableData">
- INSERT INTO vector.${tableName} (
- <foreach collection="keys" item="key" separator=",">
- ${key}
- </foreach>
- )
- VALUES
- <foreach collection="dataList" item="data" separator=",">
- (
- <foreach collection="keys" item="key" separator=",">
- <choose>
- <!-- 判断 geom 是否为空,并进行转换 -->
- <when test="key == 'geom' and data[key] != null">
- public.st_transform(public.st_geomfromewkt(#{data[${key}]}), #{shpDbSRID})
- </when>
- <otherwise>
- #{data[${key}]}
- </otherwise>
- </choose>
- </foreach>
- )
- </foreach>
- </insert>
- <select id="selectGeoms" resultType="string">
- SELECT array_to_string(array_agg(ST_AsEWKT(gd.geom)), '|') as "geoms"
- from vector.${tableName} gd
- </select>
- <select id="countByValidFlag" resultType="int">
- SELECT COUNT(*)
- FROM vector.${tableName}
- WHERE valid_flag = #{validFlag}
- </select>
- <update id="addValidFlagColumn">
- COMMENT ON COLUMN vector.${tableName}."valid_flag" IS '有效标识:0-当前版本,1-历史版本';
- </update>
- <update id="addValidFlagColumn2">
- ALTER TABLE vector.${tableName} ADD COLUMN IF NOT EXISTS valid_flag int2
- </update>
- <select id="getListByFilter" parameterType="com.siwei.apply.domain.vo.CadastreFileFilterVo" resultMap="cadastreFileMap">
- SELECT <include refid="Base_Column_List"/>
- FROM t_cadastre_file
- <where>
- <if test="name != null and name != ''">
- AND name LIKE CONCAT('%', #{name}, '%')
- </if>
- <if test="fileType != null and fileType != ''">
- AND file_type = #{fileType}
- </if>
- <if test="storageBeginTime != null and storageBeginTime != ''"><!-- 结束时间检索 -->
- AND "upload_time" >= TO_TIMESTAMP(#{storageBeginTime}, 'YYYY-MM-DD HH24:MI:SS')
- </if>
- <if test="storageEndTime != null and storageEndTime != ''"><!-- 结束时间检索 -->
- AND "upload_time" <= TO_TIMESTAMP(#{storageEndTime}, 'YYYY-MM-DD HH24:MI:SS')+ INTERVAL '1 day'
- </if>
- <if test="readStatus != null and readStatus != ''">
- AND read_status = #{readStatus}
- </if>
- </where>
- ORDER BY upload_time DESC
- LIMIT #{pageSize} OFFSET #{offset}
- </select>
- <select id="getCountByFilter" parameterType="com.siwei.apply.domain.vo.CadastreFileFilterVo" resultType="int">
- SELECT COUNT(*)
- FROM t_cadastre_file
- <where>
- <if test="name != null and name != ''">
- AND name LIKE CONCAT('%', #{name}, '%')
- </if>
- <if test="fileType != null and fileType != ''">
- AND file_type = #{fileType}
- </if>
- <if test="storageBeginTime != null and storageBeginTime != ''"><!-- 结束时间检索 -->
- AND "upload_time" >= TO_TIMESTAMP(#{storageBeginTime}, 'YYYY-MM-DD HH24:MI:SS')
- </if>
- <if test="storageEndTime != null and storageEndTime != ''"><!-- 结束时间检索 -->
- AND "upload_time" <= TO_TIMESTAMP(#{storageEndTime}, 'YYYY-MM-DD HH24:MI:SS')+ INTERVAL '1 day'
- </if>
- <!-- <if test="uploadTime != null and uploadTime != ''">-->
- <!-- AND to_char(upload_time, 'YYYY-MM-DD') = #{uploadTime}-->
- <!-- </if>-->
- <if test="readStatus != null and readStatus != ''">
- AND read_status = #{readStatus}
- </if>
- </where>
- </select>
- <update id="updateValidFlag">
- UPDATE vector.${tableName} SET valid_flag = #{validFlag} WHERE 1=1
- <if test="oldValidFlag != null and oldValidFlag != ''">
- and valid_flag= #{oldValidFlag}
- </if>
- </update>
- <delete id="deleteByValidFlag">
- DELETE FROM vector.${tableName} WHERE valid_flag = #{validFlag}
- </delete>
- <select id="selectTableData" resultType="Map">
- SELECT *
- FROM vector.${tableName} WHERE 1=1
- <if test="validFlag != null and validFlag != ''">
- and valid_flag= #{validFlag}
- </if>
- </select>
- <select id="selectTableDataByCondition" resultType="Map">
- SELECT *
- FROM vector.${tableName}
- WHERE 1=1
- <if test="validFlag != null and validFlag != ''">
- and valid_flag = #{validFlag}::int2
- </if>
- <if test="bsm != null and bsm != ''">
- and bsm= #{bsm}::int4
- </if>
- <if test="ywh != null and ywh != ''">
- and ${ywh}
- </if>
- LIMIT 100
- </select>
- <select id="selectTableDataByZDDMorBDCDYH" resultType="Map">
- SELECT *
- FROM vector.${tableName}
- WHERE 1=1
- <if test="validFlag != null and validFlag != ''">
- and valid_flag = #{validFlag}::int2
- </if>
- <if test="zdIdList != null and zdIdList.size() > 0">
- AND ${zddmKey} IN
- <foreach collection="zdIdList" item="id" open="(" separator="," close=")">
- #{id}
- </foreach>
- </if>
- <if test="bdcIdList != null and bdcIdList.size() > 0">
- AND bdcdyh IN
- <foreach collection="bdcIdList" item="id" open="(" separator="," close=")">
- #{id}
- </foreach>
- </if>
- </select>
- <select id="selectExistsSameData" resultType="Map">
- SELECT * FROM vector.${tableName}
- WHERE valid_flag = #{validFlag}
- <if test="data.rwbsm != null and data.rwbsm!='' ">
- AND rwbsm = #{data.rwbsm}
- </if>
- <if test="data.geom != null and data.geom!='' ">
- AND public.ST_Equals(geom,public.st_geomfromewkt(#{data.geom}))
- </if>
- LIMIT 1
- </select>
- <update id="batchUpdateByBsm">
- <foreach collection="list" item="data" separator=";">
- UPDATE vector.${tableName}
- <trim prefix="SET" suffixOverrides=",">
- <foreach collection="data" index="key" item="value">
- <if test="key != 'bsm' and key != 'ywh' and value != null and value != ''">
- <choose>
- <when test="key == 'geom'">
- ${key} = #{value},
- </when>
- <otherwise>
- ${key} = #{value},
- </otherwise>
- </choose>
- </if>
- </foreach>
- </trim>
- <where>
- <if test="data.bsm != null and data.bsm != ''">
- AND bsm = #{data.bsm}
- </if>
- <if test="data.ywh != null and data.ywh != ''">
- AND ywh = #{data.ywh}
- </if>
- </where>
- </foreach>
- </update>
- <delete id="batchDeleteByBsm">
- <foreach collection="list" item="data" separator=";">
- DELETE FROM vector.${tableName}
- <where>
- <if test="data.bsm != null and data.bsm != ''">
- AND bsm = #{data.bsm}
- </if>
- <if test="data.ywh != null and data.ywh != ''">
- AND ywh = #{data.ywh}
- </if>
- </where>
- </foreach>
- </delete>
- <select id="intersectsTableWkt" resultType="Map">
- SELECT *
- FROM vector.${tableName} inTbale
- where public.st_intersects(inTbale.geom,public.st_geomfromewkt(#{ewkt}))
- <if test="validFlag != null and validFlag != ''">
- and valid_flag = #{validFlag}
- </if>
- </select>
- <select id="selectTableDataByBsm" resultType="Map">
- SELECT * ,public.st_asewkt(geom) geom2 FROM vector.${tableName}
- WHERE valid_flag = 0
- <if test="bsm != null and bsm != ''">
- and bsm= ${bsm}
- </if>
- LIMIT 1
- </select>
- <select id="checkQueryWhere" resultType="String">
- EXPLAIN (FORMAT JSON)
- SELECT 1 FROM vector.${tableName} WHERE ${queryWhere} LIMIT 1
- </select>
- </mapper>
|