Browse Source

场景增加场景类型

wangyangyang 4 years ago
parent
commit
f8c4f996a5

+ 5 - 0
sms_water/src/main/java/com/huaxu/entity/SceneEntity.java

@@ -68,6 +68,11 @@ public class SceneEntity implements Serializable {
     @ApiModelProperty(value = "场景类型")
     private Long sceneTypeId;
 
+    /** 场景类型 */
+    @ApiModelProperty(value = "场景类型")
+    @TableField(exist = false)
+    private String sceneTypeName;
+
     /** 状态 */
     @ApiModelProperty(value = "状态")
     private Long enableState;

+ 11 - 2
sms_water/src/main/resources/mapper/SceneMapper.xml

@@ -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>