DoActionMapper.xml
2.77 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
<?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.DoActionMapper">
<resultMap id="actionDTO" type="org.thingsboard.server.common.data.yunteng.dto.scene.DoActionDTO">
<result property="id" column="id"/>
<result property="deviceId" column="device_id"
typeHandler="org.thingsboard.server.dao.yunteng.mapper.ListStringTypeHandler"/>
<result property="entityType" column="entity_type" typeHandler="org.apache.ibatis.type.EnumTypeHandler"/>
<result property="deviceType" column="device_type" typeHandler="org.apache.ibatis.type.EnumTypeHandler"/>
<result property="doContext" column="do_context"
typeHandler="com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler"/>
<result property="outTarget" column="out_target" typeHandler="org.apache.ibatis.type.EnumTypeHandler"/>
<result property="callType" column="call_type" typeHandler="org.apache.ibatis.type.EnumTypeHandler"/>
<result property="commandType" column="command_type"/>
<result property="thingsModelId" column="things_model_id"/>
<result property="sceneLinkageId" column="scene_linkage_id"/>
<result property="sceneLinkageName" column="scene_linkage_name"/>
<result property="deviceProfileId" column="device_profile_id"/>
<result property="alarmProfileId" column="alarm_profile_id"/>
<result property="tenantId" column="tenant_id"/>
<result property="updater" column="updater"/>
<result property="updateTime" column="update_time"/>
<result property="createTime" column="create_time"/>
<result property="creator" column="creator"/>
</resultMap>
<sql id="columns">
tda.id,tda.device_id,tda.entity_type,tda.device_type,tda.do_context,tda.out_target,tda.call_type,tda.scene_linkage_id,tda.alarm_profile_id,
tda.tenant_id,tda.updater,tda.update_time,tda.create_time,tda.creator,tda.command_type,tda.things_model_id,tda.device_profile_id
</sql>
<select id="listBySceneId" resultMap="actionDTO">
SELECT
<include refid="columns"/>
FROM tk_do_action tda WHERE tda.scene_linkage_id = #{sceneId}
</select>
<select id="listBySceneLinkageIds" resultMap="actionDTO">
SELECT
<include refid="columns"/>,tsl.name as scene_linkage_name
FROM tk_do_action tda LEFT JOIN tk_scene_linkage tsl ON tsl.id = tda.scene_linkage_id
WHERE tda.tenant_id = #{tenantId} AND tda.scene_linkage_id IN
<foreach collection="sceneLinkageIds" item="sceneLinkageId" open="(" separator="," close=")">
#{sceneLinkageId}
</foreach>
</select>
</mapper>