admin
2024-02-21 2272213fea7ab9ea6250eefad55bb113ce2b1837
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<?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.AiCameraMapper">
 
    <resultMap type="AiCamera" id="AiCameraResult">
        <result property="id"    column="id"    />
        <result property="name"    column="name"    />
        <result property="cameraNum"    column="camera_num"    />
        <result property="cameraModel"    column="camera_model"    />
        <result property="status"    column="status"    />
        <result property="region"    column="region"    />
        <result property="picture"    column="picture"    />
        <result property="cameraIp"    column="camera_ip"    />
        <result property="cameraPort"    column="camera_port"    />
        <result property="cameraUser"    column="camera_user"    />
        <result property="cameraPassword"    column="camera_password"    />
        <result property="videoSwitch"    column="video_switch"    />
        <result property="videoDuration"    column="video_duration"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
        <result property="alarmCount"    column="alarm_count"    />
        <result property="regionName"    column="region_name"    />
        <result property="runStatus"    column="run_status"    />
        <result property="leatherWidth"    column="leather_width"    />
        <result property="rtspUrl"    column="rtsp_url"    />
        <result property="toRtmp"    column="to_rtmp"    />
        <result property="playUrl"    column="play_url"    />
        <result property="rempH"    column="remp_h"    />
        <result property="rempW"    column="remp_w"    />
    </resultMap>
 
    <sql id="selectAiCameraVo">
        SELECT
            c.id,
            c.NAME,
            c.camera_num,
            c.camera_model,
            c.STATUS,
            c.region,
            ( SELECT d.dict_label FROM sys_dict_data d WHERE d.dict_type = 'sys_mine_region' AND d.dict_value = c.region ) AS region_name,
            c.picture,
            c.camera_ip,
            c.camera_port,
            c.camera_user,
            c.camera_password,
            c.video_switch,
            c.video_duration,
            c.create_by,
            c.create_time,
            c.update_by,
            c.update_time,
            c.run_status,
            c.leather_width,
            c.rtsp_url,
            c.to_rtmp,
            c.remp_h,
            c.remp_w,
            c.to_rtmp,
            c.play_url,
            ( SELECT count(*) FROM ai_alarm_info a WHERE a.camera_id = c.id and a.deal_with = '0' ) AS alarm_count,
            c.remark
        FROM
            ai_camera c
    </sql>
 
    <select id="selectAiCameraList" parameterType="AiCamera" resultMap="AiCameraResult">
        <include refid="selectAiCameraVo"/>
        <where>
            <if test="name != null  and name != ''"> and c.name like concat('%', #{name}, '%')</if>
            <if test="cameraNum != null  and cameraNum != ''"> and c.camera_num = #{cameraNum}</if>
            <if test="cameraModel != null  and cameraModel != ''"> and c.camera_model = #{cameraModel}</if>
            <if test="status != null  and status != ''"> and c.status = #{status}</if>
            <if test="region != null  and region != ''"> and c.region = #{region}</if>
            <if test="picture != null  and picture != ''"> and c.picture = #{picture}</if>
            <if test="cameraIp != null  and cameraIp != ''"> and c.camera_ip = #{cameraIp}</if>
            <if test="cameraPort != null  and cameraPort != ''"> and c.camera_port = #{cameraPort}</if>
            <if test="cameraUser != null  and cameraUser != ''"> and c.camera_user = #{cameraUser}</if>
            <if test="cameraPassword != null  and cameraPassword != ''"> and c.camera_password = #{cameraPassword}</if>
            <if test="videoSwitch != null  and videoSwitch != ''"> and c.video_switch = #{videoSwitch}</if>
            <if test="videoDuration != null "> and c.video_duration = #{videoDuration}</if>
            <if test="createTime != null "> and c.create_time = #{createTime}</if>
        </where>
    </select>
 
    <select id="queryCameraToStart" resultMap="AiCameraResult">
        <include refid="selectAiCameraVo"/>
    </select>
 
    <select id="selectAiCameraById" parameterType="Long" resultMap="AiCameraResult">
        <include refid="selectAiCameraVo"/>
        where c.id = #{id}
    </select>
 
    <insert id="insertAiCamera" parameterType="AiCamera" useGeneratedKeys="true" keyProperty="id">
        insert into ai_camera
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="name != null">name,</if>
            <if test="cameraNum != null">camera_num,</if>
            <if test="cameraModel != null">camera_model,</if>
            <if test="status != null">status,</if>
            <if test="region != null">region,</if>
            <if test="picture != null">picture,</if>
            <if test="cameraIp != null">camera_ip,</if>
            <if test="cameraPort != null">camera_port,</if>
            <if test="cameraUser != null">camera_user,</if>
            <if test="cameraPassword != null">camera_password,</if>
            <if test="videoSwitch != null">video_switch,</if>
            <if test="videoDuration != null">video_duration,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
            <if test="runStatus != null">run_status,</if>
            <if test="rtspUrl != null">rtsp_url,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="name != null">#{name},</if>
            <if test="cameraNum != null">#{cameraNum},</if>
            <if test="cameraModel != null">#{cameraModel},</if>
            <if test="status != null">#{status},</if>
            <if test="region != null">#{region},</if>
            <if test="picture != null">#{picture},</if>
            <if test="cameraIp != null">#{cameraIp},</if>
            <if test="cameraPort != null">#{cameraPort},</if>
            <if test="cameraUser != null">#{cameraUser},</if>
            <if test="cameraPassword != null">#{cameraPassword},</if>
            <if test="videoSwitch != null">#{videoSwitch},</if>
            <if test="videoDuration != null">#{videoDuration},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
            <if test="runStatus != null">#{runStatus},</if>
            <if test="rtspUrl != null">#{rtspUrl},</if>
         </trim>
    </insert>
 
    <update id="updateAiCamera" parameterType="AiCamera">
        update ai_camera
        <trim prefix="SET" suffixOverrides=",">
            <if test="name != null">name = #{name},</if>
            <if test="runStatus != null">run_status = #{runStatus},</if>
            <if test="cameraNum != null">camera_num = #{cameraNum},</if>
            <if test="cameraModel != null">camera_model = #{cameraModel},</if>
            <if test="status != null">status = #{status},</if>
            <if test="region != null">region = #{region},</if>
            <if test="picture != null">picture = #{picture},</if>
            <if test="cameraIp != null">camera_ip = #{cameraIp},</if>
            <if test="cameraPort != null">camera_port = #{cameraPort},</if>
            <if test="cameraUser != null">camera_user = #{cameraUser},</if>
            <if test="cameraPassword != null">camera_password = #{cameraPassword},</if>
            <if test="videoSwitch != null">video_switch = #{videoSwitch},</if>
            <if test="videoDuration != null">video_duration = #{videoDuration},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="rtspUrl != null">rtsp_url = #{rtspUrl},</if>
        </trim>
        where id = #{id}
    </update>
 
    <delete id="deleteAiCameraById" parameterType="Long">
        delete from ai_camera where id = #{id}
    </delete>
 
    <delete id="deleteAiCameraByIds" parameterType="String">
        delete from ai_camera where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>