admin
2024-05-27 816ba1e56476f0e23f51711aae4b34507a04a59c
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
<?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.aibrain.mapper.AiVideoFileMapper">
    
    <resultMap type="AiVideoFile" id="AiVideoFileResult">
        <result property="id"    column="id"    />
        <result property="cameraId"    column="camera_id"    />
        <result property="region"    column="region"    />
        <result property="videoType"    column="video_type"    />
        <result property="fileName"    column="file_name"    />
        <result property="filePath"    column="file_path"    />
        <result property="videoDate"    column="video_date"    />
        <result property="videoTime"    column="video_time"    />
        <result property="createDate"    column="create_date"    />
    </resultMap>
 
    <sql id="selectAiVideoFileVo">
        select id, camera_id, region, video_type, file_name, file_path, video_date, video_time, create_date from ai_video_file
    </sql>
 
    <select id="selectAiVideoFileList" parameterType="AiVideoFile" resultMap="AiVideoFileResult">
        <include refid="selectAiVideoFileVo"/>
        <where>  
            <if test="cameraId != null  and cameraId != ''"> and camera_id = #{cameraId}</if>
            <if test="region != null  and region != ''"> and region = #{region}</if>
            <if test="videoType != null  and videoType != ''"> and video_type = #{videoType}</if>
            <if test="fileName != null  and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if>
            <if test="filePath != null  and filePath != ''"> and file_path = #{filePath}</if>
            <if test="videoDate != null  and videoDate != ''"> and video_date like concat('%', #{videoDate}, '%')</if>
            <if test="videoTime != null  and videoTime != ''"> and video_time like concat('%', #{videoTime}, '%')</if>
            <if test="params.beginCreateDate != null and params.beginCreateDate != '' and params.endCreateDate != null and params.endCreateDate != ''"> and create_date between #{params.beginCreateDate} and #{params.endCreateDate}</if>
        </where>
    </select>
    
    <select id="selectAiVideoFileById" parameterType="Long" resultMap="AiVideoFileResult">
        <include refid="selectAiVideoFileVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertAiVideoFile" parameterType="AiVideoFile" useGeneratedKeys="true" keyProperty="id">
        insert into ai_video_file
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="cameraId != null">camera_id,</if>
            <if test="region != null">region,</if>
            <if test="videoType != null">video_type,</if>
            <if test="fileName != null">file_name,</if>
            <if test="filePath != null">file_path,</if>
            <if test="videoDate != null">video_date,</if>
            <if test="videoTime != null">video_time,</if>
            <if test="createDate != null">create_date,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="cameraId != null">#{cameraId},</if>
            <if test="region != null">#{region},</if>
            <if test="videoType != null">#{videoType},</if>
            <if test="fileName != null">#{fileName},</if>
            <if test="filePath != null">#{filePath},</if>
            <if test="videoDate != null">#{videoDate},</if>
            <if test="videoTime != null">#{videoTime},</if>
            <if test="createDate != null">#{createDate},</if>
         </trim>
    </insert>
 
    <update id="updateAiVideoFile" parameterType="AiVideoFile">
        update ai_video_file
        <trim prefix="SET" suffixOverrides=",">
            <if test="cameraId != null">camera_id = #{cameraId},</if>
            <if test="region != null">region = #{region},</if>
            <if test="videoType != null">video_type = #{videoType},</if>
            <if test="fileName != null">file_name = #{fileName},</if>
            <if test="filePath != null">file_path = #{filePath},</if>
            <if test="videoDate != null">video_date = #{videoDate},</if>
            <if test="videoTime != null">video_time = #{videoTime},</if>
            <if test="createDate != null">create_date = #{createDate},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteAiVideoFileById" parameterType="Long">
        delete from ai_video_file where id = #{id}
    </delete>
 
    <delete id="deleteAiVideoFileByIds" parameterType="String">
        delete from ai_video_file where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>