|
|
|
@ -14,6 +14,7 @@ |
|
|
|
|
</resultMap> |
|
|
|
|
|
|
|
|
|
<resultMap type="com.psdc.entity.vo.SceneVo" id="SceneVoMap"> |
|
|
|
|
<result property="sceneId" column="scene_id" /> |
|
|
|
|
<result property="sceneName" column="scene_name" /> |
|
|
|
|
<result property="sceneCode" column="scene_code"/> |
|
|
|
|
<result property="userId" column="user_id"/> |
|
|
|
@ -43,6 +44,40 @@ |
|
|
|
|
values (#{sceneName},#{sceneCode},#{userId},#{deviceId},#{deviceSn},#{sceneContext},#{sceneKey},#{sceneValue}) |
|
|
|
|
</insert> |
|
|
|
|
|
|
|
|
|
<insert id="InsertSceneData" parameterType="com.psdc.entity.vo.SceneVo" useGeneratedKeys="true"> |
|
|
|
|
Insert into psdc_scene(scene_name,scene_code,user_id,device_id,device_sn,scene_context,scene_key,scene_value) |
|
|
|
|
Values |
|
|
|
|
<foreach collection="sceneRecord" item="entity" separator=","> |
|
|
|
|
(#{entity.sceneName}, #{entity.sceneCode},#{entity.userId}, #{entity.deviceId}, #{entity.deviceSn}, #{entity.sceneContext}, #{entity.sceneKey}, #{entity.sceneValue}) |
|
|
|
|
</foreach> |
|
|
|
|
</insert> |
|
|
|
|
|
|
|
|
|
<update id="UpdateSceneData"> |
|
|
|
|
<foreach collection="sceneRecord" item="item" index="index" open="" close="" separator=";"> |
|
|
|
|
Update psdc_scene |
|
|
|
|
<set> |
|
|
|
|
<if test="item.sceneName != null and item.sceneName != ''"> |
|
|
|
|
`scene_name`= #{item.sceneName}, |
|
|
|
|
</if> |
|
|
|
|
<if test="item.deviceSn != null and item.deviceSn != ''"> |
|
|
|
|
`device_sn` = #{item.deviceSn}, |
|
|
|
|
</if> |
|
|
|
|
<if test="item.sceneContext != null and item.sceneContext != ''"> |
|
|
|
|
`scene_context` = #{item.sceneContext}, |
|
|
|
|
</if> |
|
|
|
|
<if test="item.sceneKey != null and item.sceneKey != ''"> |
|
|
|
|
`scene_key` = ${item.sceneKey}, |
|
|
|
|
</if> |
|
|
|
|
<if test="item.sceneValue != null and item.sceneValue != ''"> |
|
|
|
|
`scene_value` = ${item.sceneValue} |
|
|
|
|
</if> |
|
|
|
|
</set> |
|
|
|
|
<where> |
|
|
|
|
`scene_id` = ${item.sceneId} |
|
|
|
|
</where> |
|
|
|
|
</foreach> |
|
|
|
|
</update> |
|
|
|
|
|
|
|
|
|
<!-- 更新数据 --> |
|
|
|
|
<update id="update"> |
|
|
|
|
update psdc_scene |
|
|
|
@ -118,9 +153,9 @@ |
|
|
|
|
|
|
|
|
|
<!-- 根据策略名称查询策略信息--> |
|
|
|
|
<select id="queryBySceneName" resultMap="SceneVoMap"> |
|
|
|
|
select ps.scene_id,ps.scene_name,ps.scene_code,ps.user_id,pd.device_name,ps.device_id,pd.device_sn,ps.scene_context,ps.scene_key,ps.scene_value |
|
|
|
|
from psdc_scene ps left join psdc_device pd on ps.device_id = pd.device_id |
|
|
|
|
where ps.scene_name like concat('%', #{sceneName}, '%') |
|
|
|
|
Select ps.scene_id,ps.scene_name,ps.scene_code,ps.user_id,pd.device_name,ps.device_id,pd.device_sn,ps.scene_context,ps.scene_key,ps.scene_value |
|
|
|
|
From psdc_scene ps Left join psdc_device pd on ps.device_id = pd.device_id |
|
|
|
|
Where ps.scene_name Like concat('%', #{sceneName}, '%') |
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
<select id="findSceneByUserAndSceneName" resultMap="SceneVoMap"> |
|
|
|
|