|
@@ -45,14 +45,18 @@
|
|
|
a.date_create as "dateCreate" ,
|
|
|
a.create_by as "createBy" ,
|
|
|
a.date_update as "dateUpdate" ,
|
|
|
- a.update_by as "updateBy"
|
|
|
+ a.update_by as "updateBy",
|
|
|
+ s.scene_type_name as "sceneTypeName"
|
|
|
</sql>
|
|
|
-
|
|
|
+ <sql id="deviceJoins">
|
|
|
+ left join sms_scene_type s on s.id =a.scene_type_id
|
|
|
+ </sql>
|
|
|
<!-- 根据主键获取实体 -->
|
|
|
<select id="findSceneById" resultType="com.huaxu.entity.SceneEntity">
|
|
|
SELECT
|
|
|
<include refid="sceneColumns"/>
|
|
|
FROM sms_scene a
|
|
|
+ <include refid="deviceJoins"/>
|
|
|
WHERE a.id = #{id} and a.status=1
|
|
|
</select>
|
|
|
|
|
@@ -61,6 +65,7 @@
|
|
|
SELECT
|
|
|
<include refid="sceneColumns"/>
|
|
|
FROM sms_scene a
|
|
|
+ <include refid="deviceJoins"/>
|
|
|
<where>
|
|
|
a.status=1
|
|
|
<if test="scene.tenantId != null and scene.tenantId != ''">and a.tenant_id = #{scene.tenantId}</if>
|
|
@@ -103,6 +108,7 @@
|
|
|
<select id="findBySceneTypeIds" resultType="com.huaxu.entity.SceneEntity">
|
|
|
select a.id
|
|
|
FROM sms_scene a
|
|
|
+ <include refid="deviceJoins"/>
|
|
|
WHERE a.scene_type_id in
|
|
|
<foreach collection = "Ids" item = "dramaId" open = "(" close = ")" separator = "," >
|
|
|
#{dramaId}
|
|
@@ -112,6 +118,7 @@
|
|
|
<select id="findByParentSceneIds" resultType="com.huaxu.entity.SceneEntity">
|
|
|
select a.id
|
|
|
FROM sms_scene a
|
|
|
+ <include refid="deviceJoins"/>
|
|
|
WHERE a.parent_scene_id in
|
|
|
<foreach collection = "Ids" item = "dramaId" open = "(" close = ")" separator = "," >
|
|
|
#{dramaId}
|
|
@@ -121,6 +128,7 @@
|
|
|
SELECT
|
|
|
<include refid="sceneColumns"/>
|
|
|
FROM sms_scene a
|
|
|
+ <include refid="deviceJoins"/>
|
|
|
<where>
|
|
|
a.status=1
|
|
|
<if test="scene.tenantId != null and scene.tenantId != ''">and a.tenant_id = #{scene.tenantId}</if>
|
|
@@ -159,6 +167,7 @@
|
|
|
SELECT
|
|
|
<include refid="sceneColumns"/>
|
|
|
FROM sms_scene a
|
|
|
+ <include refid="deviceJoins"/>
|
|
|
<where>
|
|
|
a.status=1 and a.parent_scene_id=0
|
|
|
<if test="scene.tenantId != null and scene.tenantId != ''">and a.tenant_id = #{scene.tenantId}</if>
|