TkVideoMapper.xml
5.23 KB
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
<?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="org.thingsboard.server.dao.yunteng.mapper.TkVideoMapper">
<resultMap type="org.thingsboard.server.common.data.yunteng.dto.TkVideoDTO" id="videoMap">
<result property="id" column="id"/>
<result property="name" column="name"/>
<result property="avatar" column="avatar"/>
<result property="videoUrl" column="video_url"/>
<result property="brand" column="brand"/>
<result property="deviceType" column="device_type" />
<result property="sn" column="sn"/>
<result property="tenantId" column="tenant_id"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<result property="creator" column="creator"/>
<result property="updater" column="updater"/>
<result property="description" column="description"/>
<result property="status" column="status"/>
<result property="additionalJson" column="additional_json"/>
<result property="organizationId" column="organization_id"/>
<result property="organizationName" column="organization_name"/>
<result property="accessMode" column="access_mode"/>
<result property="videoPlatformId" column="video_platform_id"/>
<result property="streamType" column="stream_type"/>
<result property="playProtocol" column="play_protocol"/>
<result property="params" column="params"
typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/>
<association property="videoPlatformDTO" javaType="org.thingsboard.server.common.data.yunteng.dto.TkVideoPlatformDTO">
<result property="host" column="host"/>
<result property="appKey" column="app_key"/>
<result property="appSecret" column="app_secret"/>
<result property="ssl" column="ssl"/>
<result property="protocolType" column="protocol_type" typeHandler="org.apache.ibatis.type.EnumTypeHandler"/>
<result property="remark" column="remark"/>
<result property="type" column="type"/>
</association>
</resultMap>
<sql id="basicColumns">
base.id,base.sn,base.name,base.avatar,base.video_url,base.description,base.status,base.additional_json,
base.device_type,base.organization_id,base.brand,base.access_mode,base.video_platform_id,base.stream_type,
base.play_protocol,base.tenant_id,base.create_time,base.update_time,base.creator, base.updater,base.params
</sql>
<sql id="detailColumns">
<include refid="basicColumns"/>
,org.name AS organization_name,ivp.host,ivp.app_key,ivp.app_secret,ivp.ssl,ivp.remark,ivp.protocol_type,
ivp.type
</sql>
<select id="getVideoPage" resultMap="videoMap">
SELECT
<include refid="detailColumns"/>
FROM tk_device_camera base
LEFT JOIN tk_organization org ON org.id = base.organization_id
LEFT JOIN tk_video_platform ivp ON ivp.id = base.video_platform_id
<where>
<if test="tenantId !=null and tenantId !=''">
AND base.tenant_id = #{tenantId}
</if>
<if test="name !=null and name !=''">
AND base.name LIKE concat('%',#{name}::TEXT,'%')
</if>
<if test="status !=null">
AND base.status = #{status}
</if>
<if test="organization !=null">
AND base.organization_id IN
<foreach collection="organization" item="organizationId" open="(" separator="," close=")">
#{organizationId}
</foreach>
</if>
</where>
</select>
<select id="getVideoInfosByTenantIdOrAccessModeOrId" resultMap="videoMap">
SELECT
<include refid="detailColumns"/>
FROM tk_device_camera base
LEFT JOIN tk_organization org ON org.id = base.organization_id
LEFT JOIN tk_video_platform ivp ON ivp.id = base.video_platform_id
<where>
<if test="tenantId !=null and tenantId !=''">
AND base.tenant_id = #{tenantId}
</if>
<if test="id !=null and id !=''">
AND base.id = #{id}
</if>
<if test="accessMode !=null">
AND base.access_mode = #{accessMode}
</if>
</where>
</select>
<select id="getVideoInfosByOrganizationIds" resultMap="videoMap">
SELECT
<include refid="detailColumns"/>
FROM tk_device_camera base
LEFT JOIN tk_organization org ON org.id = base.organization_id
LEFT JOIN tk_video_platform ivp ON ivp.id = base.video_platform_id
<where>
<if test="tenantId !=null and tenantId !=''">
AND base.tenant_id = #{tenantId}
</if>
<if test="organizationIds !=null">
AND base.organization_id IN
<foreach collection="organizationIds" item="organizationId" open="(" separator="," close=")">
#{organizationId}
</foreach>
</if>
</where>
</select>
</mapper>