zhaowenxuan
2025-02-06 06c12d2b42c343798d9476be66031b48967df639
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
<?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.ltkj.hosp.mapper.SysAttachmentMapper">
 
    <resultMap type="SysAttachment" id="SysAttachmentResult">
            <result property="id" column="id"/>
            <result property="sysDictVal" column="sys_dict_val"/>
            <result property="filePath" column="file_path"/>
            <result property="fileName" column="file_name"/>
            <result property="fileSize" column="file_size"/>
            <result property="fileSizeMb" column="file_size_mb"/>
            <result property="fileSizeGb" column="file_size_gb"/>
            <result property="uploadTime" column="upload_time"/>
            <result property="ip" column="ip"/>
            <result property="url" column="url"/>
    </resultMap>
 
    <sql id="selectSysAttachmentVo">
        select id, sys_dict_val, file_path, file_name, file_size, file_size_mb, file_size_gb, upload_time, ip,url
        from sys_attachment
    </sql>
 
    <select id="selectSysAttachmentList" parameterType="SysAttachment" resultMap="SysAttachmentResult">
        <include refid="selectSysAttachmentVo"/>
        <where>
                        <if test="sysDictVal != null  and sysDictVal != ''">
                            and sys_dict_val = #{sysDictVal}
                        </if>
                        <if test="filePath != null  and filePath != ''">
                            and file_path = #{filePath}
                        </if>
                        <if test="fileName != null  and fileName != ''">
                            and file_name like concat('%', #{fileName}, '%')
                        </if>
                        <if test="fileSize != null  and fileSize != ''">
                            and file_size = #{fileSize}
                        </if>
                        <if test="fileSizeMb != null  and fileSizeMb != ''">
                            and file_size_mb = #{fileSizeMb}
                        </if>
                        <if test="fileSizeGb != null  and fileSizeGb != ''">
                            and file_size_gb = #{fileSizeGb}
                        </if>
                        <if test="uploadTime != null ">
                            and upload_time = #{uploadTime}
                        </if>
                        <if test="ip != null  and ip != ''">
                            and ip = #{ip}
                        </if>
                        <if test="url != null  and url != ''">
                            and url = #{url}
                        </if>
        </where>
    </select>
 
    <select id="selectSysAttachmentById" parameterType="Long"
            resultMap="SysAttachmentResult">
            <include refid="selectSysAttachmentVo"/>
            where id = #{id}
    </select>
 
    <insert id="insertSysAttachment" parameterType="SysAttachment">
        insert into sys_attachment
        <trim prefix="(" suffix=")" suffixOverrides=",">
                    <if test="id != null">id,
                    </if>
                    <if test="sysDictVal != null">sys_dict_val,
                    </if>
                    <if test="filePath != null and filePath != ''">file_path,
                    </if>
                    <if test="fileName != null and fileName != ''">file_name,
                    </if>
                    <if test="fileSize != null and fileSize != ''">file_size,
                    </if>
                    <if test="fileSizeMb != null and fileSizeMb != ''">file_size_mb,
                    </if>
                    <if test="fileSizeGb != null and fileSizeGb != ''">file_size_gb,
                    </if>
                    <if test="uploadTime != null">upload_time,
                    </if>
                    <if test="ip != null and ip != ''">ip,
                    </if>
                    <if test="url != null and url != ''">url,
                    </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
                    <if test="id != null">#{id},
                    </if>
                    <if test="sysDictVal != null">#{sysDictVal},
                    </if>
                    <if test="filePath != null and filePath != ''">#{filePath},
                    </if>
                    <if test="fileName != null and fileName != ''">#{fileName},
                    </if>
                    <if test="fileSize != null and fileSize != ''">#{fileSize},
                    </if>
                    <if test="fileSizeMb != null and fileSizeMb != ''">#{fileSizeMb},
                    </if>
                    <if test="fileSizeGb != null and fileSizeGb != ''">#{fileSizeGb},
                    </if>
                    <if test="uploadTime != null">#{uploadTime},
                    </if>
                    <if test="ip != null and ip != ''">#{ip},
                    </if>
                    <if test="url != null and url != ''">#{url},
                    </if>
        </trim>
    </insert>
 
    <update id="updateSysAttachment" parameterType="SysAttachment">
        update sys_attachment
        <trim prefix="SET" suffixOverrides=",">
                    <if test="sysDictVal != null">sys_dict_val =
                        #{sysDictVal},
                    </if>
                    <if test="filePath != null and filePath != ''">file_path =
                        #{filePath},
                    </if>
                    <if test="fileName != null and fileName != ''">file_name =
                        #{fileName},
                    </if>
                    <if test="fileSize != null and fileSize != ''">file_size =
                        #{fileSize},
                    </if>
                    <if test="fileSizeMb != null and fileSizeMb != ''">file_size_mb =
                        #{fileSizeMb},
                    </if>
                    <if test="fileSizeGb != null and fileSizeGb != ''">file_size_gb =
                        #{fileSizeGb},
                    </if>
                    <if test="uploadTime != null">upload_time =
                        #{uploadTime},
                    </if>
                    <if test="ip != null and ip != ''">ip =
                        #{ip},
                    </if>
                    <if test="url != null and url != ''">ip =
                        #{url},
                    </if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteSysAttachmentById" parameterType="Long">
        delete
        from sys_attachment where id = #{id}
    </delete>
 
    <delete id="deleteSysAttachmentByIds" parameterType="String">
        delete from sys_attachment where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>