邱宇豪
2023-10-26 a12423474cd5384898fb91dba49dea23931f7b9a
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
182
183
184
185
<?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.thhy.engineering.modules.biz.device.mapper.TVideoMapper">
  <resultMap id="BaseResultMap" type="com.thhy.engineering.modules.biz.device.entity.TVideo">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
      This element was generated on Mon May 15 14:28:08 CST 2023.
    -->
    <id column="video_id" jdbcType="VARCHAR" property="videoId" />
    <result column="video_name" jdbcType="VARCHAR" property="videoName" />
    <result column="video_type" jdbcType="VARCHAR" property="videoType" />
    <result column="video_path" jdbcType="VARCHAR" property="videoPath" />
    <result column="longitude" jdbcType="VARCHAR" property="longitude" />
    <result column="latitude" jdbcType="VARCHAR" property="latitude" />
    <result column="company_id" jdbcType="VARCHAR" property="companyId" />
    <result column="is_use" jdbcType="INTEGER" property="isUse" />
    <result column="create_user" jdbcType="VARCHAR" property="createUser" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  </resultMap>
 
  <insert id="videoInsert" >
    insert into t_video
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="videoId != null">
        video_id,
      </if>
      <if test="videoName != null">
        video_name,
      </if>
      <if test="videoType != null">
        video_type,
      </if>
      <if test="videoPath != null">
        video_path,
      </if>
      <if test="longitude != null">
        longitude,
      </if>
      <if test="latitude != null">
        latitude,
      </if>
      <if test="companyId != null">
        company_id,
      </if>
      <if test="isUse != null">
        is_use,
      </if>
      <if test="createUser != null">
        create_user,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="videoSn != null">
        video_sn,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="videoId != null">
        #{videoId,jdbcType=VARCHAR},
      </if>
      <if test="videoName != null">
        #{videoName,jdbcType=VARCHAR},
      </if>
      <if test="videoType != null">
        #{videoType,jdbcType=VARCHAR},
      </if>
      <if test="videoPath != null">
        #{videoPath,jdbcType=VARCHAR},
      </if>
      <if test="longitude != null">
        #{longitude,jdbcType=VARCHAR},
      </if>
      <if test="latitude != null">
        #{latitude,jdbcType=VARCHAR},
      </if>
      <if test="companyId != null">
        #{companyId,jdbcType=VARCHAR},
      </if>
      <if test="isUse != null">
        #{isUse,jdbcType=INTEGER},
      </if>
      <if test="createUser != null">
        #{createUser,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="videoSn != null">
        #{videoSn,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
 
  <select id="videoList" resultType="com.thhy.engineering.modules.biz.device.entity.TVideo">
    SELECT
    tv.video_id AS videoId,
    tv.video_name AS videoName,
    tv.video_path AS videoPath,
    tv.video_type AS videoType,
    tv.longitude AS longitude,
    tv.latitude AS latitude,
    tv.video_sn as videoSn,
    sd.dict_name AS videoTypeName,
    tv.create_time as createTime
    FROM
    t_video tv
    LEFT JOIN sys_dict sd ON tv.video_type = sd.dict_id
    WHERE
    tv.is_use =1
        <if test="videoName!=null and videoName!='' ">
          and tv.video_name like concat('%',#{videoName},'%')
        </if>
        <if test="videoType!=null and videoType!='' ">
          and tv.video_type=#{videoType}
        </if>
    <if test="companyId!=null and companyId!='' ">
      and tv.company_id=#{companyId}
    </if>
        order by tv.create_time desc
  </select>
  <select id="videoInfo" parameterType="java.lang.String" resultType="com.thhy.engineering.modules.biz.device.entity.TVideo">
    SELECT
    tv.video_id AS videoId,
    tv.video_name AS videoName,
    tv.video_path AS videoPath,
    tv.video_type AS videoType,
    tv.longitude AS longitude,
    tv.latitude AS latitude,
    tv.video_sn as videoSn,
    sd.dict_name AS videoTypeName
    FROM
    t_video tv
    LEFT JOIN sys_dict sd ON tv.video_type = sd.dict_id
    WHERE
    tv.is_use =1 and tv.video_id=#{videoId}
  </select>
 
  <update id="videoDel" parameterType="java.lang.String">
        update t_video set
        is_use=2
        where video_id=#{videoId}
  </update>
  
  <update id="videoUpdate" >
    update t_video
    <set>
      <if test="videoName != null">
        video_name = #{videoName,jdbcType=VARCHAR},
      </if>
      <if test="videoType != null">
        video_type = #{videoType,jdbcType=VARCHAR},
      </if>
      <if test="videoPath != null">
        video_path = #{videoPath,jdbcType=VARCHAR},
      </if>
      <if test="longitude != null">
        longitude = #{longitude,jdbcType=VARCHAR},
      </if>
      <if test="latitude != null">
        latitude = #{latitude,jdbcType=VARCHAR},
      </if>
      <if test="companyId != null">
        company_id = #{companyId,jdbcType=VARCHAR},
      </if>
      <if test="isUse != null">
        is_use = #{isUse,jdbcType=INTEGER},
      </if>
      <if test="createUser != null">
        create_user = #{createUser,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="videoSn != null">
        video_sn = #{videoSn,jdbcType=VARCHAR},
      </if>
    </set>
    where video_id = #{videoId,jdbcType=VARCHAR}
  </update>
  <select id="videoSnByOne" parameterType="java.lang.String" resultType="java.lang.String">
    select video_id from t_video where video_sn=#{videoSn} and is_use=1
  </select>
</mapper>