From 514705c874699fb016ca405961e50dcb15af2648 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期二, 28 十一月 2023 10:28:16 +0800
Subject: [PATCH] 栅格分析返回值添加图层单位字段

---
 src/main/resources/mapper/data/PublishMapper.xml |   67 ++++++++++++++++++++++++---------
 1 files changed, 49 insertions(+), 18 deletions(-)

diff --git a/src/main/resources/mapper/data/PublishMapper.xml b/src/main/resources/mapper/data/PublishMapper.xml
index 8dfb4f1..7eb3e17 100644
--- a/src/main/resources/mapper/data/PublishMapper.xml
+++ b/src/main/resources/mapper/data/PublishMapper.xml
@@ -46,14 +46,14 @@
     </select>
 
     <select id="selectCount" resultType="java.lang.Integer">
-        select count(*) from lf.sys_publish
+        select count(*) from lf.sys_publish a
         <where>
             1 = 1
             <if test="name != null">
-                and upper(name) like #{name}
+                and upper(a.name) like #{name}
             </if>
             <if test="dircode != null">
-                and dirid like #{dircode}
+                and a.dirid like #{dircode}
             </if>
             <if test="type != null">
                 and ${type}
@@ -62,15 +62,15 @@
     </select>
 
     <select id="selectByPage" resultType="com.moon.server.entity.data.PublishEntity">
-        select ST_AsText(geom) "geom", a.*, fn_get_fullname(a.depid, 1) depName, fn_get_fullname(a.dirid, 2) dirName, fn_uname(create_user) createName, fn_uname(update_user) updateName
-        from lf.sys_publish a
+        select ST_AsText(a.geom) "geom", a.*, fn_get_fullname(a.depid, 1) depName, fn_get_fullname(a.dirid, 2) dirName, fn_uname(a.create_user) createName, fn_uname(a.update_user) updateName, b.proxy
+        from lf.sys_publish a left join lf.sys_res b on a.id = b.pubid
         <where>
             1 = 1
             <if test="name != null">
-                and upper(name) like #{name}
+                and upper(a.name) like #{name}
             </if>
             <if test="dircode != null">
-                and dirid like #{dircode}
+                and a.dirid like #{dircode}
             </if>
             <if test="type != null">
                 and ${type}
@@ -85,13 +85,36 @@
     </select>
 
     <select id="selectById" resultType="com.moon.server.entity.data.PublishEntity">
-        select ST_AsText(geom) "geom", a.*, fn_get_fullname(a.depid, 1) depName, fn_get_fullname(a.dirid, 2) dirName, fn_uname(create_user) createName, fn_uname(update_user) updateName
-        from lf.sys_publish a
-        where id = #{id}
+        select ST_AsText(a.geom) "geom", a.*, fn_get_fullname(a.depid, 1) depName, fn_get_fullname(a.dirid, 2) dirName, fn_uname(a.create_user) createName, fn_uname(a.update_user) updateName, b.proxy
+        from lf.sys_publish a left join lf.sys_res b on a.id = b.pubid
+        where a.id = #{id}
     </select>
 
     <select id="selectByIds" resultType="com.moon.server.entity.data.PublishEntity">
         select * from lf.sys_publish where id in (${ids}) order by id desc;
+    </select>
+
+    <select id="selectMetasByPubid" resultType="com.moon.server.entity.data.MetaEntity">
+        select a.*
+        from lf.sys_meta a
+        inner join lf.sys_meta_pub b
+        on a.id = b.metaid
+        where b.pubid = #{pubid};
+    </select>
+
+    <select id="selectRaster" resultType="com.moon.server.entity.data.PublishEntity">
+        select c.cn_name "name", c.unit, a.*
+        from lf.sys_publish a inner join lf.sys_res b on a.id = b.pubid
+        inner join lf.sys_layer c on b.id = c.resid
+        where a.type in ('DOM', 'DEM') and a.status = 3 and c.status = 1;
+    </select>
+
+    <select id="selectByLayerId" resultType="com.moon.server.entity.data.PublishEntity">
+        select a.*
+        from lf.sys_publish a inner join lf.sys_res b on a.id = b.pubid
+        inner join lf.sys_layer c on b.id = c.resid
+        where c.id = #{layerId}
+        limit 1;
     </select>
 
     <select id="selectCodesForDir" resultType="java.lang.String">
@@ -114,22 +137,32 @@
     </select>
 
     <insert id="insert" parameterType="com.moon.server.entity.data.PublishEntity">
+        <selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
+            select currval('lf.sys_publish_id_seq'::regclass) as id
+        </selectKey>
+
         insert into lf.sys_publish
-        (layerid,serviceid,name,url,path,type,status,dirid,depid,min,max,json,create_user,create_time,geom,bak)
+        (layerid,serviceid,eventid,name,url,path,type,status,dirid,depid,enhance_type,min,max,epsg,ct_type,ct_json,json,create_user,create_time,geom,bak)
         values
-        (#{layerid},#{serviceid},#{name},#{url},#{path},#{type},#{status},#{dirid},#{depid},#{min},#{max},#{json},#{createUser},now(),${geom},#{bak})
+        (#{layerid},#{serviceid},#{eventid},#{name},#{url},#{path},#{type},#{status},#{dirid},#{depid},#{enhanceType},#{min},#{max},#{epsg},#{ctType},#{ctJson},#{json},#{createUser},now(),${geom},#{bak})
     </insert>
 
     <insert id="insertPubDown">
         insert into lf.sys_pub_down (pubid, downid, create_user) values (#{pubid}, #{downid}, #{createUser})
     </insert>
+    
+    <insert id="insertMetaPub" parameterType="com.moon.server.entity.data.MetaPubEntity">
+        insert into lf.sys_meta_pub(metaid, pubid, create_user, create_time)
+        values
+        (#{metaid}, #{pubid}, #{createUser}, now());
+    </insert>
 
     <insert id="inserts">
         insert into lf.sys_publish
-        (layerid,serviceid,,name,url,path,type,status,dirid,depid,min,max,json,create_user,create_time,geom,bak)
+        (layerid,serviceid,eventid,name,url,path,type,status,dirid,depid,enhance_type,min,max,epsg,ct_type,ct_json,json,create_user,create_time,geom,bak)
         values
         <foreach collection="list" item="item" index="index" separator=",">
-            (#{item.layerid},#{item.serviceid},#{item.name},#{item.url},#{item.path},#{item.type},#{item.status},#{item.dirid},#{item.depid},#{item.min},#{item.max},#{item.json},#{item.createUser},now(),${item.geom},#{item.bak})
+            (#{item.layerid},#{item.serviceid},#{item.eventid},#{item.name},#{item.url},#{item.path},#{item.type},#{item.status},#{item.dirid},#{item.depid},#{item.enhanceType},#{item.min},#{item.max},#{item.epsg},#{item.ctType},#{item.ctJson},#{item.json},#{item.createUser},now(),${item.geom},#{item.bak})
         </foreach>
     </insert>
 
@@ -153,16 +186,14 @@
 
     <update id="update">
         update lf.sys_publish
-        set layerid=#{layerid},serviceid=#{serviceid},name=#{name},url=#{url},path=#{path},type=#{type},status=#{status},dirid=#{dirid},depid=#{depid},min=#{min},max=#{max},json=#{json},update_user=#{updateUser},update_time=now(),geom=${geom},bak=#{bak}
+        set layerid=#{layerid},serviceid=#{serviceid},eventid=#{eventid},name=#{name},url=#{url},path=#{path},type=#{type},status=#{status},dirid=#{dirid},depid=#{depid},enhance_type=#{enhanceType},min=#{min},max=#{max},epsg=#{epsg},ct_type=#{ctType},ct_json=#{ctJson},json=#{json},update_user=#{updateUser},update_time=now(),geom=${geom},bak=#{bak}
         where id=#{id}
     </update>
 
     <update id="updates">
         <foreach collection="list" item="item" index="index" separator=";">
             update lf.sys_publish
-            <set>
-                layerid=#{item.layerid},serviceid=#{item.serviceid},name=#{item.name},url=#{item.url},path=#{item.path},type=#{item.type},status=#{item.status},dirid=#{item.dirid},depid=#{item.depid},min=#{item.min},max=#{item.max},json=#{item.json},update_user=#{item.updateUser},update_time=now(),geom=#{item.geom},bak=#{item.bak}
-            </set>
+            set layerid=#{item.layerid},serviceid=#{item.serviceid},eventid=#{item.eventid},name=#{item.name},url=#{item.url},path=#{item.path},type=#{item.type},status=#{item.status},dirid=#{item.dirid},depid=#{item.depid},enhance_type=#{item.enhanceType},min=#{item.min},max=#{item.max},epsg=#{item.epsg},ct_type=#{item.ctType},ct_json=#{item.ctJson},json=#{item.json},update_user=#{item.updateUser},update_time=now(),geom=${item.geom},bak=#{item.bak}
             where id = #{item.id}
         </foreach>
     </update>

--
Gitblit v1.9.3