管道基础大数据平台系统开发-【后端】-Server
13693261870
2024-03-25 1c285b38777e9f37ee8d112e994443d3640b78c1
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
<?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.lf.server.mapper.sys.AttachMapper">
    <select id="selectCount" resultType="java.lang.Integer">
        select count(*) from lf.sys_attach
        <where>
            <if test="name != null">
                upper(name) like #{name}
            </if>
        </where>
    </select>
 
    <select id="selectByPage" resultType="com.lf.server.entity.sys.AttachEntity">
        select * from lf.sys_attach
        <where>
            <if test="name != null">
                upper(name) like #{name}
            </if>
        </where>
        order by id desc
        limit #{limit} offset #{offset}
    </select>
 
    <select id="selectAll" resultType="com.lf.server.entity.sys.AttachEntity">
        select * from lf.sys_attach order by id desc;
    </select>
 
    <select id="selectById" resultType="com.lf.server.entity.sys.AttachEntity">
        select * from lf.sys_attach where id = #{id}
    </select>
 
    <select id="selectByGuid" resultType="com.lf.server.entity.sys.AttachEntity">
        select * from lf.sys_attach where guid = #{guid} limit 1
    </select>
 
    <select id="selectByGuids" resultType="com.lf.server.entity.sys.AttachEntity">
        select * from lf.sys_attach where guid in
        <foreach item="guid" collection="guids" index="index" open="(" separator="," close=")">
            #{guid}
        </foreach>
    </select>
 
    <select id="selectByTabAndGuid" resultType="com.lf.server.entity.sys.AttachEntity">
        select * from lf.sys_attach where tab = #{tab} and tab_guid = #{tabGuid} and guid = #{guid} limit 1
    </select>
 
    <select id="selectByTabGuids" resultType="com.lf.server.entity.sys.AttachEntity">
        select * from lf.sys_attach
        <where>
            tab = #{tab}
            <if test="guids != null">
                and tab_guid in
                <foreach item="guid" collection="guids" index="index" open="(" separator="," close=")">
                    #{guid}
                </foreach>
            </if>
        </where>
    </select>
 
    <select id="selectByTab" resultType="com.lf.server.entity.sys.AttachEntity">
        select * from lf.sys_attach where tab = #{tab} and tab_guid = #{guid}
    </select>
 
    <insert id="insert" parameterType="com.lf.server.entity.sys.AttachEntity">
       insert into lf.sys_attach
       (name,tab,tab_guid,guid,path,sizes,create_user,create_time)
       values
       (#{name},#{tab},#{tabGuid},#{guid},#{path},#{sizes},#{createUser},now())
    </insert>
 
    <insert id="inserts">
        insert into lf.sys_attach
        (name,tab,tab_guid,guid,path,sizes,create_user,create_time)
        values
        <foreach collection="list" item="item" index="index" separator=",">
            (#{item.name},#{item.tab},#{item.tabGuid},#{item.guid},#{item.path},#{item.sizes},#{item.createUser},now())
        </foreach>
    </insert>
 
    <delete id="delete">
        delete from lf.sys_attach where id = #{id}
    </delete>
 
    <delete id="deletes">
        delete from lf.sys_attach where id in
        <foreach item="id" collection="ids" index="index" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
 
    <update id="update">
        update lf.sys_attach
        set name=#{name},tab=#{tab},tab_guid=#{tabGuid},guid=#{guid},path=#{path},sizes=#{sizes},update_user=#{updateUser},update_time=now()
        where id=#{id}
    </update>
 
    <update id="updates">
        <foreach collection="list" item="item" index="index" separator=";">
            update lf.sys_attach
            <set>
                name=#{item.name},tab=#{item.tab},tab_guid=#{item.tabGuid},guid=#{item.guid},path=#{item.path},sizes=#{item.sizes},update_user=#{item.updateUser},update_time=now()
            </set>
            where id = #{item.id}
        </foreach>
    </update>
 
    <select id="selectFmeLogs" resultType="com.lf.server.entity.data.FmeLogEntity">
        select * from lf.sys_fme_log
        where count > 0 and update_time is null and create_time > now()::timestamp + '-5 min' and position(tcdm in '${tabs}') > 0;
    </select>
 
    <update id="updateFmeLog">
        update lf.sys_fme_log set update_time = now() where id = #{id};
    </update>
 
    <!-- and create_time > now()::timestamp + '-15 min' -->
    <insert id="insertAttachByMeta">
        insert into lf.sys_attach (name, guid, path, sizes, create_user, tab, tab_guid)
        select name, guid, path, sizes, create_user, #{tab}, #{tabGuid}
        from lf.sys_meta
        <where>
            name = #{metaName}
            <if test="dirid != null">
                and dircode like #{dirid}
            </if>
        </where>
        order by id desc
        limit 1;
    </insert>
</mapper>