<?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.moon.server.mapper.data.MetaMapper">
|
<select id="selectCount" resultType="java.lang.Integer">
|
select count(*) from lf.sys_meta
|
<where>
|
ismeta between 0 and 1
|
<if test="depcode != null">
|
and depcode like #{depcode}
|
</if>
|
<if test="dircode != null">
|
and dircode like #{dircode}
|
</if>
|
<if test="verid != null">
|
and verid = #{verid}
|
</if>
|
<if test="name != null">
|
and upper(name) like #{name}
|
</if>
|
<if test="wkt != null">
|
and ${wkt}
|
</if>
|
</where>
|
</select>
|
|
<select id="selectByPage" resultType="com.moon.server.entity.data.MetaEntity">
|
select st_astext(geom) "geom",a.*,fn_uname(a.create_user) uname,fn_get_fullname(a.depcode, 1) depName,fn_ver(a.verid) verName,fn_get_fullname(a.dircode, 2) dirName
|
from lf.sys_meta a
|
<where>
|
ismeta between 0 and 1
|
<if test="depcode != null">
|
and depcode like #{depcode}
|
</if>
|
<if test="dircode != null">
|
and dircode like #{dircode}
|
</if>
|
<if test="verid != null">
|
and verid = #{verid}
|
</if>
|
<if test="name != null">
|
and upper(name) like #{name}
|
</if>
|
<if test="wkt != null">
|
and ${wkt}
|
</if>
|
</where>
|
order by id desc
|
limit #{limit} offset #{offset}
|
</select>
|
|
<select id="selectGdbByGuid" resultType="com.moon.server.entity.data.MetaEntity">
|
select a.*,fn_uname(a.create_user) uname,fn_get_fullname(a.depcode, 1) depName,fn_ver(a.verid) verName,fn_get_fullname(a.dircode, 2) dirName
|
from lf.sys_meta a
|
where type = 'gdb' and guid = #{guid};
|
</select>
|
|
<select id="selectMetasForCount" resultType="java.lang.Integer">
|
select count(*) from lf.sys_meta
|
<where>
|
1 = 1
|
<if test="depcode != null">
|
and depcode like #{depcode}
|
</if>
|
<if test="dirs != null">
|
and ${dirs}
|
</if>
|
<if test="name != null">
|
and upper(name) like #{name}
|
</if>
|
</where>
|
</select>
|
|
<select id="selectMetasForPage" resultType="com.moon.server.entity.data.MetaEntity">
|
select a.*,fn_uname(a.create_user) uname,fn_get_fullname(a.depcode, 1) depName,fn_ver(a.verid) verName,fn_get_fullname(a.dircode, 2) dirName,
|
(select coalesce(sum(dcount), 0) from lf.sys_download b inner join lf.sys_meta_down c on b.id = c.downid where c.metaid = a.id) "downCount",
|
(select fn_uname(download_user) from lf.sys_download b inner join lf.sys_meta_down c on b.id = c.downid where c.metaid = a.id order by download_time desc limit 1) "lastUser",
|
(select max(download_time) from lf.sys_download b inner join lf.sys_meta_down c on b.id = c.downid where c.metaid = a.id) "lastTime"
|
from lf.sys_meta a
|
<where>
|
1 = 1
|
<if test="depcode != null">
|
and depcode like #{depcode}
|
</if>
|
<if test="dirs != null">
|
and ${dirs}
|
</if>
|
<if test="name != null">
|
and upper(name) like #{name}
|
</if>
|
</where>
|
order by id desc
|
limit #{limit} offset #{offset}
|
</select>
|
|
<select id="selectCountForUpload" resultType="java.lang.Integer">
|
select count(*) from lf.sys_meta
|
<where>
|
create_user = #{createUser}
|
<if test="types != null">
|
and type in (${types})
|
</if>
|
<if test="name != null">
|
and upper(name) like #{name}
|
</if>
|
</where>
|
</select>
|
|
<select id="selectByPageForUpload" resultType="com.moon.server.entity.data.MetaEntity">
|
select st_astext(geom) "geom",a.*,fn_uname(a.create_user) uname,fn_get_fullname(a.depcode, 1) depName,fn_ver(a.verid) verName,fn_get_fullname(a.dircode, 2) dirName
|
from lf.sys_meta a
|
<where>
|
create_user = #{createUser}
|
<if test="types != null">
|
and type in (${types})
|
</if>
|
<if test="name != null">
|
and upper(name) like #{name}
|
</if>
|
</where>
|
order by id desc
|
limit #{limit} offset #{offset}
|
</select>
|
|
<select id="selectCountByPid" resultType="java.lang.Integer">
|
select count(*) from lf.sys_meta
|
<where>
|
metaid = #{metaid}
|
<if test="name != null">
|
and upper(name) like #{name}
|
</if>
|
</where>
|
</select>
|
|
<select id="selectPageByPid" resultType="com.moon.server.entity.data.MetaEntity">
|
select a.*,fn_uname(a.create_user) uname,fn_get_fullname(a.depcode, 1) depName,fn_ver(a.verid) verName,fn_get_fullname(a.dircode, 2) dirName
|
from lf.sys_meta a
|
<where>
|
metaid = #{metaid}
|
<if test="name != null">
|
and upper(name) like #{name}
|
</if>
|
</where>
|
order by id desc
|
limit #{limit} offset #{offset}
|
</select>
|
|
<select id="selectById" resultType="com.moon.server.entity.data.MetaEntity">
|
select a.*,fn_uname(a.create_user) uname,fn_get_fullname(a.depcode, 1) depName,fn_ver(a.verid) verName,fn_get_fullname(a.dircode, 2) dirName
|
from lf.sys_meta a where id = #{id}
|
</select>
|
|
<select id="selectByGuid" resultType="com.moon.server.entity.data.MetaEntity">
|
select st_astext(geom) "geom",a.*,fn_uname(a.create_user) uname,fn_get_fullname(a.depcode, 1) depName,fn_ver(a.verid) verName,fn_get_fullname(a.dircode, 2) dirName
|
from lf.sys_meta a
|
where guid = #{guid}
|
<if test="dircode != null">
|
and dircode like #{dircode}
|
</if>
|
<if test="tab != null">
|
and tab = #{tab}
|
</if>
|
limit 1
|
</select>
|
|
<select id="selectByIdsForTab" resultType="com.moon.server.entity.data.MetaEntity">
|
select a.* from lf.sys_meta a
|
where id in (${ids}) and a.tab is not null and a.rows > 0
|
order by a.tab;
|
</select>
|
|
<select id="selectMetaFiles" resultType="com.moon.server.entity.data.MetaEntity">
|
select a.*,fn_uname(a.create_user) uname,fn_get_fullname(a.depcode, 1) depName,fn_ver(a.verid) verName,fn_get_fullname(a.dircode, 2) dirName
|
from lf.sys_meta a
|
where id in
|
<foreach item="id" collection="ids" index="index" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
order by a.id desc
|
</select>
|
|
<select id="selectXlsAnnex" resultType="com.moon.server.entity.data.MetaEntity">
|
select * from lf.sys_meta
|
where type in ('xls', 'xlsx') and eventid is not null and tab is not null and rows > 0 and id in
|
<foreach item="id" collection="ids" index="index" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
<if test="tabs != null">
|
and tab in (${tabs})
|
</if>
|
</select>
|
|
<select id="selectMetasByDirCode" resultType="com.moon.server.entity.data.MetaEntity">
|
select a.*, fn_uname(a.create_user) uname, fn_get_fullname(a.depcode, 1) depName, fn_ver(a.verid) verName, fn_get_fullname(a.dircode, 2) dirName
|
from lf.sys_meta a
|
where dircode like #{dircode} and
|
(type = 'tif' or type = 'tiff' or lower(name) in ('平面图索引文件.xlsx', '穿跨越地形图.dwg', '中线成果表.xlsx', '离散点.xlsx', '控制点.xlsx', '地面线.xlsx'))
|
order by id;
|
</select>
|
|
<select id="selectMetaOverflowDep" resultType="java.lang.String">
|
select depcode
|
from lf.sys_meta
|
where id in (${ids}) and depcode not like #{depcode}
|
group by depcode
|
order by depcode;
|
</select>
|
|
<insert id="insert" parameterType="com.moon.server.entity.data.MetaEntity">
|
<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
|
select currval('lf.sys_meta_id_seq'::regclass) as id
|
</selectKey>
|
|
insert into lf.sys_meta
|
(eventid,metaid,verid,name,type,guid,path,sizes,tab,rows,create_user,create_time,bak,geom,layer,depcode,dircode,ismeta,sensortype,acq_time,resolution,gridsize,coor_sys,epsg,h_datum,mata_type,bands,band_type,ct)
|
values
|
(#{eventid},#{metaid},#{verid},#{name},#{type},#{guid},#{path},#{sizes},#{tab},#{rows},#{createUser},now(),#{bak},${geom},#{layer},#{depcode},#{dircode},#{ismeta},#{sensortype},#{acqTime},#{resolution},#{gridsize},#{coorSys},#{epsg},#{hDatum},#{mataType},#{bands},#{bandType},#{ct})
|
</insert>
|
|
<insert id="inserts">
|
insert into lf.sys_meta
|
(eventid,metaid,verid,name,type,guid,path,sizes,tab,rows,create_user,create_time,bak,geom,layer,depcode,dircode,ismeta,sensortype,acq_time,resolution,gridsize,coor_sys,epsg,h_datum,mata_type,bands,band_type,ct)
|
values
|
<foreach collection="list" item="item" index="index" separator=",">
|
(#{item.eventid},#{item.metaid},#{item.verid},#{item.name},#{item.type},#{item.guid},#{item.path},#{item.sizes},#{item.tab},#{item.rows},#{item.createUser},now(),#{item.bak},${item.geom},#{item.layer},#{item.depcode},#{item.dircode},#{item.ismeta},#{item.sensortype},#{item.acqTime},#{item.resolution},#{item.gridsize},#{item.coorSys},#{item.epsg},#{item.hDatum},#{item.mataType},#{item.bands},#{item.bandType},#{item.ct})
|
</foreach>
|
</insert>
|
|
<delete id="deletes">
|
delete from lf.sys_meta where id in (${ids});
|
<if test="sql != null">
|
${sql};
|
</if>
|
</delete>
|
|
<delete id="deletes_old">
|
delete from lf.sys_meta where id in
|
<foreach item="id" collection="ids" index="index" open="(" separator="," close=")">
|
#{id}
|
</foreach>
|
</delete>
|
|
<update id="update">
|
update lf.sys_meta
|
set eventid=#{eventid},metaid=#{metaid},verid=#{verid},name=#{name},type=#{type},guid=#{guid},path=#{path},sizes=#{sizes},tab=#{tab},rows=#{rows},update_user=#{updateUser},update_time=now(),bak=#{bak},geom=${geom},layer=#{layer},depcode=#{depcode},dircode=#{dircode},ismeta=#{ismeta},sensortype=#{sensortype},acq_time=#{acqTime},resolution=#{resolution},gridsize=#{gridsize},coor_sys=#{coorSys},epsg=#{epsg},h_datum=#{hDatum},mata_type=#{mataType},bands=#{bands},band_type=#{bandType},ct=#{ct}
|
where id=#{id}
|
</update>
|
|
<update id="updates">
|
<foreach collection="list" item="item" index="index" separator=";">
|
update lf.sys_meta
|
set eventid=#{item.eventid},metaid=#{item.metaid},verid=#{item.verid},name=#{item.name},type=#{item.type},guid=#{item.guid},path=#{item.path},sizes=#{item.sizes},tab=#{item.tab},rows=#{item.rows},update_user=#{item.updateUser},update_time=now(),bak=#{item.bak},geom=${item.geom},layer=#{item.layer},depcode=#{item.depcode},dircode=#{item.dircode},ismeta=#{item.ismeta},sensortype=#{item.sensortype},acq_time=#{item.acqTime},resolution=#{item.resolution},gridsize=#{item.gridsize},coor_sys=#{item.coorSys},epsg=#{item.epsg},h_datum=#{item.hDatum},mata_type=#{item.mataType},bands=#{item.bands},band_type=#{item.bandType},ct=#{item.ct}
|
where id = #{item.id}
|
</foreach>
|
</update>
|
</mapper>
|