|
|
|
@ -24,6 +24,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
<result property="updateTime" column="update_time" />
|
|
|
|
|
<result property="fenceField" column="fence_field" />
|
|
|
|
|
<result property="sceneName" column="scene_name" />
|
|
|
|
|
<result property="deviceModeName" column="device_mode_name" />
|
|
|
|
|
<result property="deviceName" column="device_name" />
|
|
|
|
|
<result property="deviceModeId" column="device_mode_id" />
|
|
|
|
|
<result property="deviceId" column="device_id" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<resultMap id="HwElectronicFenceHwFenceTargetResult" type="HwElectronicFence" extends="HwElectronicFenceResult">
|
|
|
|
@ -37,34 +41,91 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectHwElectronicFenceVo">
|
|
|
|
|
select electronic_fence_id, electronic_fence_name, tenant_id, scene_id, fence_type, effective_time_flag, time_zone, effective_time, trigger_status, fence_push_flag, fence_push_content, fence_recover_content, remark, create_by, create_time, update_by, update_time, fence_field from hw_electronic_fence
|
|
|
|
|
select hef.electronic_fence_id,
|
|
|
|
|
hef.electronic_fence_name,
|
|
|
|
|
hef.tenant_id,
|
|
|
|
|
hef.scene_id,
|
|
|
|
|
hef.fence_type,
|
|
|
|
|
hef.effective_time_flag,
|
|
|
|
|
hef.time_zone,
|
|
|
|
|
hef.effective_time,
|
|
|
|
|
hef.trigger_status,
|
|
|
|
|
hef.fence_push_flag,
|
|
|
|
|
hef.fence_push_content,
|
|
|
|
|
hef.fence_recover_content,
|
|
|
|
|
hef.remark,
|
|
|
|
|
hef.create_by,
|
|
|
|
|
hef.create_time,
|
|
|
|
|
hef.update_by,
|
|
|
|
|
hef.update_time,
|
|
|
|
|
hef.fence_field,
|
|
|
|
|
hdm.device_mode_name,
|
|
|
|
|
hd.device_name,
|
|
|
|
|
hef.device_mode_id,
|
|
|
|
|
hef.device_id,
|
|
|
|
|
hs.scene_name
|
|
|
|
|
from hw_electronic_fence hef
|
|
|
|
|
left join hw_device_mode hdm on hdm.device_mode_id = hef.device_mode_id
|
|
|
|
|
left join hw_device hd on hd.device_id = hef.device_id
|
|
|
|
|
left join hw_scene hs on hs.scene_id = hef.scene_id
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectHwElectronicFenceList" parameterType="HwElectronicFence" resultMap="HwElectronicFenceResult">
|
|
|
|
|
<include refid="selectHwElectronicFenceVo"/>
|
|
|
|
|
<where>
|
|
|
|
|
trigger_status !='9'
|
|
|
|
|
<if test="electronicFenceName != null and electronicFenceName != ''"> and electronic_fence_name like concat('%', #{electronicFenceName}, '%')</if>
|
|
|
|
|
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
|
|
|
|
|
<if test="sceneId != null "> and scene_id = #{sceneId}</if>
|
|
|
|
|
<if test="fenceType != null and fenceType != ''"> and fence_type = #{fenceType}</if>
|
|
|
|
|
<if test="effectiveTimeFlag != null and effectiveTimeFlag != ''"> and effective_time_flag = #{effectiveTimeFlag}</if>
|
|
|
|
|
<if test="timeZone != null and timeZone != ''"> and time_zone = #{timeZone}</if>
|
|
|
|
|
<if test="effectiveTime != null and effectiveTime != ''"> and effective_time = #{effectiveTime}</if>
|
|
|
|
|
<if test="triggerStatus != null and triggerStatus != ''"> and trigger_status = #{triggerStatus}</if>
|
|
|
|
|
<if test="fencePushFlag != null and fencePushFlag != ''"> and fence_push_flag = #{fencePushFlag}</if>
|
|
|
|
|
<if test="fencePushContent != null and fencePushContent != ''"> and fence_push_content = #{fencePushContent}</if>
|
|
|
|
|
<if test="fenceRecoverContent != null and fenceRecoverContent != ''"> and fence_recover_content = #{fenceRecoverContent}</if>
|
|
|
|
|
<if test="fenceField != null and fenceField != ''"> and fence_field = #{fenceField}</if>
|
|
|
|
|
<if test="electronicFenceName != null and electronicFenceName != ''"> and hef.electronic_fence_name like concat('%', #{electronicFenceName}, '%')</if>
|
|
|
|
|
<if test="tenantId != null "> and hef.tenant_id = #{tenantId}</if>
|
|
|
|
|
<if test="sceneId != null "> and hef.scene_id = #{sceneId}</if>
|
|
|
|
|
<if test="fenceType != null and fenceType != ''"> and hef.fence_type = #{fenceType}</if>
|
|
|
|
|
<if test="effectiveTimeFlag != null and effectiveTimeFlag != ''"> and hef.effective_time_flag = #{effectiveTimeFlag}</if>
|
|
|
|
|
<if test="timeZone != null and timeZone != ''"> and hef.time_zone = #{timeZone}</if>
|
|
|
|
|
<if test="effectiveTime != null and effectiveTime != ''"> and hef.effective_time = #{effectiveTime}</if>
|
|
|
|
|
<if test="triggerStatus != null and triggerStatus != ''"> and hef.trigger_status = #{triggerStatus}</if>
|
|
|
|
|
<if test="fencePushFlag != null and fencePushFlag != ''"> and hef.fence_push_flag = #{fencePushFlag}</if>
|
|
|
|
|
<if test="fencePushContent != null and fencePushContent != ''"> and hef.fence_push_content = #{fencePushContent}</if>
|
|
|
|
|
<if test="fenceRecoverContent != null and fenceRecoverContent != ''"> and hef.fence_recover_content = #{fenceRecoverContent}</if>
|
|
|
|
|
<if test="fenceField != null and fenceField != ''"> and hef.fence_field = #{fenceField}</if>
|
|
|
|
|
<if test="deviceModeName != null and deviceModeName != ''"> and hef.device_mode_name = #{deviceModeName}</if>
|
|
|
|
|
<if test="deviceName != null and deviceName != ''"> and hd.device_name = #{deviceName}</if>
|
|
|
|
|
<if test="deviceModeId != null "> and hef.device_mode_id = #{deviceModeId}</if>
|
|
|
|
|
<if test="deviceId != null "> and hef.device_id = #{deviceId}</if>
|
|
|
|
|
<if test="sceneName != null ">and hs.scene_name = #{sceneName}</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectHwElectronicFenceByElectronicFenceId" parameterType="Long" resultMap="HwElectronicFenceHwFenceTargetResult">
|
|
|
|
|
select a.electronic_fence_id, a.electronic_fence_name, a.tenant_id, a.scene_id, a.fence_type, a.effective_time_flag, a.time_zone, a.effective_time, a.trigger_status, a.fence_push_flag, a.fence_push_content, a.fence_recover_content, a.remark, a.create_by, a.create_time, a.update_by, a.update_time, a.fence_field,
|
|
|
|
|
b.electronic_fence_id as sub_electronic_fence_id, b.target_type as sub_target_type, b.target_id as sub_target_id
|
|
|
|
|
from hw_electronic_fence a
|
|
|
|
|
left join hw_fence_target b on b.electronic_fence_id = a.electronic_fence_id
|
|
|
|
|
where a.electronic_fence_id = #{electronicFenceId}
|
|
|
|
|
select hef.electronic_fence_id,
|
|
|
|
|
hef.electronic_fence_name,
|
|
|
|
|
hef.tenant_id,
|
|
|
|
|
hef.scene_id,
|
|
|
|
|
hef.fence_type,
|
|
|
|
|
hef.effective_time_flag,
|
|
|
|
|
hef.time_zone,
|
|
|
|
|
hef.effective_time,
|
|
|
|
|
hef.trigger_status,
|
|
|
|
|
hef.fence_push_flag,
|
|
|
|
|
hef.fence_push_content,
|
|
|
|
|
hef.fence_recover_content,
|
|
|
|
|
hef.remark,
|
|
|
|
|
hef.create_by,
|
|
|
|
|
hef.create_time,
|
|
|
|
|
hef.update_by,
|
|
|
|
|
hef.update_time,
|
|
|
|
|
hef.fence_field,
|
|
|
|
|
hft.electronic_fence_id as sub_electronic_fence_id,
|
|
|
|
|
hft.target_type as sub_target_type,
|
|
|
|
|
hft.target_id as sub_target_id,
|
|
|
|
|
hd.device_name ,
|
|
|
|
|
hef.device_id ,
|
|
|
|
|
hef.device_mode_id ,
|
|
|
|
|
hs.scene_name,
|
|
|
|
|
hdm.device_mode_name
|
|
|
|
|
from hw_electronic_fence hef
|
|
|
|
|
left join hw_fence_target hft on hft.electronic_fence_id = hef.electronic_fence_id
|
|
|
|
|
left join hw_device_mode hdm on hdm.device_mode_id = hef.device_mode_id
|
|
|
|
|
left join hw_device hd on hd.device_id = hef.device_id
|
|
|
|
|
left join hw_scene hs on hs.scene_id = hef.scene_id
|
|
|
|
|
where hef.electronic_fence_id = #{electronicFenceId}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertHwElectronicFence" parameterType="HwElectronicFence" useGeneratedKeys="true" keyProperty="electronicFenceId">
|
|
|
|
@ -87,6 +148,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
<if test="updateBy != null">update_by,</if>
|
|
|
|
|
<if test="updateTime != null">update_time,</if>
|
|
|
|
|
<if test="fenceField != null">fence_field,</if>
|
|
|
|
|
<if test="deviceModeId != null">device_mode_id,</if>
|
|
|
|
|
<if test="deviceId != null">device_id,</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="electronicFenceName != null and electronicFenceName != ''">#{electronicFenceName},</if>
|
|
|
|
@ -106,6 +169,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
|
|
<if test="fenceField != null">#{fenceField},</if>
|
|
|
|
|
<if test="deviceModeId != null">device_mode_id,</if>
|
|
|
|
|
<if test="deviceId != null">device_id,</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
@ -129,6 +194,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
|
|
<if test="fenceField != null">fence_field = #{fenceField},</if>
|
|
|
|
|
<if test="deviceModeId != null">device_mode_id = #{deviceModeId},</if>
|
|
|
|
|
<if test="deviceId != null">device_id = #{deviceId},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where electronic_fence_id = #{electronicFenceId}
|
|
|
|
|
</update>
|
|
|
|
@ -207,6 +274,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
<if test="fencePushContent != null and fencePushContent != ''"> and hef.fence_push_content = #{fencePushContent}</if>
|
|
|
|
|
<if test="fenceRecoverContent != null and fenceRecoverContent != ''"> and hef.fence_recover_content = #{fenceRecoverContent}</if>
|
|
|
|
|
<if test="fenceField != null and fenceField != ''"> and hef.fence_field = #{fenceField}</if>
|
|
|
|
|
<if test="deviceModeName != null and deviceModeName != ''"> and hdm.device_model_name like concat('%', #{deviceModeName}, '%')</if>
|
|
|
|
|
<if test="deviceName != null and deviceName != ''"> and hd.device_name like concat('%', #{deviceName}, '%')</if>
|
|
|
|
|
<if test="deviceId != null "> and hef.device_id = #{deviceId}</if>
|
|
|
|
|
<if test="deviceModeId != null "> and hef.device_mode_id = #{deviceModeId}</if>
|
|
|
|
|
<!-- 租户数据范围过滤 -->
|
|
|
|
|
${params.tenantDataScope}
|
|
|
|
|
</where>
|
|
|
|
|