13693261870
2025-07-02 7c7cb1855b7f18802f55a70fa14ed70cbdb11bab
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
<?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.terra.system.mapper.data.PublishMapper">
    <select id="selectMetasByCount" resultType="java.lang.Integer">
        select count(*) from lf.sys_meta
        <where>
            ${types}
            <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>
        </where>
    </select>
 
    <select id="selectMetasByPage" resultType="com.terra.system.entity.data.MetaEntity">
        select
            (select c.url from lf.sys_meta_pub b inner join lf.sys_publish c on b.pubid = c.id where b.metaid = a.id limit 1) "url",
            (select ST_AsText(c.geom) from lf.sys_meta_pub b inner join lf.sys_publish c on b.pubid = c.id where b.metaid = a.id limit 1) "geom",
            a.*, fn_uname(a.create_user) uname, fn_get_fullname(a.depcode, 1) depName, fn_get_fullname(a.dircode, 2) dirName, fn_ver(a.verid) verName
        from lf.sys_meta a
        <where>
            ${types}
            <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>
        </where>
        order by id desc
        limit #{limit} offset #{offset}
    </select>
 
    <select id="selectCount" resultType="java.lang.Integer">
        select count(*) from lf.sys_publish
        <where>
            1 = 1
            <if test="name != null">
                and upper(name) like #{name}
            </if>
            <if test="dircode != null">
                and dirid like #{dircode}
            </if>
            <if test="type != null">
                and ${type}
            </if>
        </where>
    </select>
 
    <select id="selectByPage" resultType="com.terra.system.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>
            1 = 1
            <if test="name != null">
                and upper(name) like #{name}
            </if>
            <if test="dircode != null">
                and dirid like #{dircode}
            </if>
            <if test="type != null">
                and ${type}
            </if>
        </where>
        order by a.update_time desc, a.create_time desc
        limit #{limit} offset #{offset}
    </select>
 
    <select id="selectAll" resultType="com.terra.system.entity.data.PublishEntity">
        select * from lf.sys_publish order by id desc;
    </select>
 
    <select id="selectById" resultType="com.terra.system.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>
 
    <select id="selectByIds" resultType="com.terra.system.entity.data.PublishEntity">
        select * from lf.sys_publish where id in (${ids}) order by id desc;
    </select>
 
    <select id="selectCodesForDir" resultType="java.lang.String">
        select code
        from lf.sys_dir
        <where>
            <choose>
                <when test="isDom > 0">
                    name in ('DOM', '数字正射影像图')
                </when>
                <otherwise>
                    name in ('DEM', '数字高程模型')
                </otherwise>
            </choose>
            <if test="dircode != null">
                and code like #{dircode}
            </if>
        </where>
        order by code;
    </select>
 
    <insert id="insert" parameterType="com.terra.system.entity.data.PublishEntity">
        insert into lf.sys_publish
        (regid,name,url,path,type,status,dirid,depid,min,max,json,create_user,create_time,bak)
        values
        (#{regid},#{name},#{url},#{path},#{type},#{status},#{dirid},#{depid},#{min},#{max},#{json},#{createUser},now(),#{bak})
    </insert>
 
    <insert id="insertPubDown">
        insert into lf.sys_pub_down (pubid, downid, create_user) values (#{pubid}, #{downid}, #{createUser})
    </insert>
 
    <insert id="inserts">
        insert into lf.sys_publish
        (regid,name,url,path,type,status,dirid,depid,min,max,json,create_user,create_time,bak)
        values
        <foreach collection="list" item="item" index="index" separator=",">
            (#{item.regid},#{item.name},#{item.url},#{item.path},#{item.type},#{item.status},#{item.dirid},#{item.depid},#{item.min},#{item.max},#{item.json},#{item.createUser},now(),#{item.bak})
        </foreach>
    </insert>
 
    <delete id="delete">
        delete from lf.sys_publish where id = #{id}
    </delete>
 
    <delete id="deletes">
        delete from lf.sys_publish where id in (${ids});
        delete from lf.sys_layer where pubid in (${ids});
        delete from lf.sys_meta_pub where pubid in (${ids});
    </delete>
 
    <update id="update">
        update lf.sys_publish
        set regid=#{regid},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(),bak=#{bak}
        where id=#{id}
    </update>
 
    <update id="updates">
        <foreach collection="list" item="item" index="index" separator=";">
            update lf.sys_publish
            <set>
                regid=#{item.regid},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(),bak=#{item.bak}
            </set>
            where id = #{item.id}
        </foreach>
    </update>
</mapper>