liusuyi
2024-10-10 38f29e38fcc668171dc05c53d40a36b895c86102
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
<?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.ruoyi.storage.minio.mapper.StorageMinioEventMapper">
    
    <resultMap type="StorageMinioEvent" id="StorageMinioEventResult">
        <result property="id"    column="id"    />
        <result property="eventType"    column="event_type"    />
        <result property="bucketName"    column="bucket_name"    />
        <result property="eventTime"    column="event_time"    />
        <result property="host"    column="host"    />
        <result property="userName"    column="user_name"    />
        <result property="endpoint"    column="endpoint"    />
        <result property="objectName"    column="object_name"    />
        <result property="objectType"    column="object_type"    />
        <result property="objectSize"    column="object_size"    />
        <result property="createTime"    column="create_time"    />
    </resultMap>
 
    <sql id="selectStorageMinioEventVo">
        select id, event_type, bucket_name, event_time, host, user_name, endpoint, object_name, object_type, object_size, create_time from storage_minio_event
    </sql>
 
    <select id="selectStorageMinioEventList" parameterType="StorageMinioEvent" resultMap="StorageMinioEventResult">
        <include refid="selectStorageMinioEventVo"/>
        <where>  
            <if test="eventType != null  and eventType != ''"> and event_type = #{eventType}</if>
            <if test="host != null  and host != ''"> and host = #{host}</if>
        </where>
        order by create_time desc
    </select>
    
    <select id="selectStorageMinioEventById" parameterType="String" resultMap="StorageMinioEventResult">
        <include refid="selectStorageMinioEventVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertStorageMinioEvent" parameterType="StorageMinioEvent">
        insert into storage_minio_event
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="eventType != null">event_type,</if>
            <if test="bucketName != null">bucket_name,</if>
            <if test="eventTime != null">event_time,</if>
            <if test="host != null">host,</if>
            <if test="userName != null">user_name,</if>
            <if test="endpoint != null">endpoint,</if>
            <if test="objectName != null">object_name,</if>
            <if test="objectType != null">object_type,</if>
            <if test="objectSize != null">object_size,</if>
            <if test="createTime != null">create_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="eventType != null">#{eventType},</if>
            <if test="bucketName != null">#{bucketName},</if>
            <if test="eventTime != null">#{eventTime},</if>
            <if test="host != null">#{host},</if>
            <if test="userName != null">#{userName},</if>
            <if test="endpoint != null">#{endpoint},</if>
            <if test="objectName != null">#{objectName},</if>
            <if test="objectType != null">#{objectType},</if>
            <if test="objectSize != null">#{objectSize},</if>
            <if test="createTime != null">#{createTime},</if>
         </trim>
    </insert>
 
    <update id="updateStorageMinioEvent" parameterType="StorageMinioEvent">
        update storage_minio_event
        <trim prefix="SET" suffixOverrides=",">
            <if test="eventType != null">event_type = #{eventType},</if>
            <if test="bucketName != null">bucket_name = #{bucketName},</if>
            <if test="eventTime != null">event_time = #{eventTime},</if>
            <if test="host != null">host = #{host},</if>
            <if test="userName != null">user_name = #{userName},</if>
            <if test="endpoint != null">endpoint = #{endpoint},</if>
            <if test="objectName != null">object_name = #{objectName},</if>
            <if test="objectType != null">object_type = #{objectType},</if>
            <if test="objectSize != null">object_size = #{objectSize},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteStorageMinioEventById" parameterType="String">
        delete from storage_minio_event where id = #{id}
    </delete>
 
    <delete id="deleteStorageMinioEventByIds" parameterType="String">
        delete from storage_minio_event where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>