|
|
|
@ -77,11 +77,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectDeviceNum" parameterType="Long" resultMap="HwDeviceResult" >
|
|
|
|
|
<include refid="selectHwDeviceVo"/>
|
|
|
|
|
where scene_id = #{sceneId}
|
|
|
|
|
where hd.scene_id = #{sceneId}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectDeviceByMonitorId" parameterType="Long" resultMap="HwDeviceResult">
|
|
|
|
|
<include refid="selectHwDeviceVo"/>
|
|
|
|
|
where monitor_unit_id = #{monitorUnitId}
|
|
|
|
|
where hd.monitor_unit_id = #{monitorUnitId}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectDeviceByDeviceModeBySceneId" parameterType="Long" resultMap="HwDeviceResult">
|
|
|
|
|
select * from hw_device where device_mode_id = (
|
|
|
|
@ -94,36 +94,67 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
<!--以上为监控平台接口所用-->
|
|
|
|
|
|
|
|
|
|
<sql id="selectHwDeviceVo">
|
|
|
|
|
select device_id, device_code, device_name, scene_id, monitor_unit_id, device_type, networking_mode, access_protocol, data_format, releated_device_id, device_mode_id, access_gw_protocol, active_status, device_status, active_time, device_pic, ip_address, area_id, device_location, current_module_version, current_singlechip_version, remark, create_by, create_time, update_by, update_time, device_field, tenant_id, online_status from hw_device hd
|
|
|
|
|
select hd.device_id,
|
|
|
|
|
hd.device_code,
|
|
|
|
|
hd.device_name,
|
|
|
|
|
hd.scene_id,
|
|
|
|
|
hd.monitor_unit_id,
|
|
|
|
|
hmu.monitor_unit_name,
|
|
|
|
|
hd.device_type,
|
|
|
|
|
hd.networking_mode,
|
|
|
|
|
hd.access_protocol,
|
|
|
|
|
hd.data_format,
|
|
|
|
|
hd.releated_device_id,
|
|
|
|
|
hd.device_mode_id,
|
|
|
|
|
hd.access_gw_protocol,
|
|
|
|
|
hd.active_status,
|
|
|
|
|
hd.device_status,
|
|
|
|
|
hd.active_time,
|
|
|
|
|
hd.device_pic,
|
|
|
|
|
hd.ip_address,
|
|
|
|
|
hd.area_id,
|
|
|
|
|
hd.device_location,
|
|
|
|
|
hd.current_module_version,
|
|
|
|
|
hd.current_singlechip_version,
|
|
|
|
|
hd.remark,
|
|
|
|
|
hd.create_by,
|
|
|
|
|
hd.create_time,
|
|
|
|
|
hd.update_by,
|
|
|
|
|
hd.update_time,
|
|
|
|
|
hd.device_field,
|
|
|
|
|
hd.tenant_id,
|
|
|
|
|
hd.online_status
|
|
|
|
|
from hw_device hd
|
|
|
|
|
left join hw_monitor_unit hmu on hmu.monitor_unit_id = hd.monitor_unit_id
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectHwDeviceList" parameterType="HwDevice" resultMap="HwDeviceResult">
|
|
|
|
|
<include refid="selectHwDeviceVo"/>
|
|
|
|
|
<where>
|
|
|
|
|
and device_status !='9'
|
|
|
|
|
<if test="deviceCode != null and deviceCode != ''"> and device_code like concat('%', #{deviceCode}, '%')</if>
|
|
|
|
|
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
|
|
|
|
|
<if test="sceneId != null "> and scene_id = #{sceneId}</if>
|
|
|
|
|
<if test="monitorUnitId != null "> and monitor_unit_id = #{monitorUnitId}</if>
|
|
|
|
|
<if test="deviceType != null and deviceType != ''"> and device_type = #{deviceType}</if>
|
|
|
|
|
<if test="networkingMode != null and networkingMode != ''"> and networking_mode = #{networkingMode}</if>
|
|
|
|
|
<if test="accessProtocol != null "> and access_protocol = #{accessProtocol}</if>
|
|
|
|
|
<if test="dataFormat != null "> and data_format = #{dataFormat}</if>
|
|
|
|
|
<if test="releatedDeviceId != null "> and releated_device_id = #{releatedDeviceId}</if>
|
|
|
|
|
<if test="deviceModeId != null "> and device_mode_id = #{deviceModeId}</if>
|
|
|
|
|
<if test="accessGwProtocol != null "> and access_gw_protocol = #{accessGwProtocol}</if>
|
|
|
|
|
<if test="activeStatus != null and activeStatus != ''"> and active_status = #{activeStatus}</if>
|
|
|
|
|
<if test="deviceStatus != null and deviceStatus != ''"> and device_status = #{deviceStatus}</if>
|
|
|
|
|
<if test="activeTime != null "> and active_time = #{activeTime}</if>
|
|
|
|
|
<if test="devicePic != null and devicePic != ''"> and device_pic = #{devicePic}</if>
|
|
|
|
|
<if test="ipAddress != null and ipAddress != ''"> and ip_address = #{ipAddress}</if>
|
|
|
|
|
<if test="areaId != null "> and area_id = #{areaId}</if>
|
|
|
|
|
<if test="deviceLocation != null and deviceLocation != ''"> and device_location = #{deviceLocation}</if>
|
|
|
|
|
<if test="currentModuleVersion != null and currentModuleVersion != ''"> and current_module_version = #{currentModuleVersion}</if>
|
|
|
|
|
<if test="currentSinglechipVersion != null and currentSinglechipVersion != ''"> and current_singlechip_version = #{currentSinglechipVersion}</if>
|
|
|
|
|
<if test="deviceField != null and deviceField != ''"> and device_field = #{deviceField}</if>
|
|
|
|
|
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
|
|
|
|
|
<if test="onlineStatus != null and onlineStatus != ''"> and online_status = #{onlineStatus}</if>
|
|
|
|
|
<if test="deviceCode != null and deviceCode != ''"> and hd.device_code like concat('%', #{deviceCode}, '%')</if>
|
|
|
|
|
<if test="deviceName != null and deviceName != ''"> and hd.device_name like concat('%', #{deviceName}, '%')</if>
|
|
|
|
|
<if test="sceneId != null "> and hd.scene_id = #{sceneId}</if>
|
|
|
|
|
<if test="monitorUnitId != null "> and hd.monitor_unit_id = #{monitorUnitId}</if>
|
|
|
|
|
<if test="deviceType != null and deviceType != ''"> and hd.device_type = #{deviceType}</if>
|
|
|
|
|
<if test="networkingMode != null and networkingMode != ''"> and hd.networking_mode = #{networkingMode}</if>
|
|
|
|
|
<if test="accessProtocol != null "> and hd.access_protocol = #{accessProtocol}</if>
|
|
|
|
|
<if test="dataFormat != null "> and hd.data_format = #{dataFormat}</if>
|
|
|
|
|
<if test="releatedDeviceId != null "> and hd.releated_device_id = #{releatedDeviceId}</if>
|
|
|
|
|
<if test="deviceModeId != null "> and hd.device_mode_id = #{deviceModeId}</if>
|
|
|
|
|
<if test="accessGwProtocol != null "> and hd.access_gw_protocol = #{accessGwProtocol}</if>
|
|
|
|
|
<if test="activeStatus != null and activeStatus != ''"> and hd.active_status = #{activeStatus}</if>
|
|
|
|
|
<if test="deviceStatus != null and deviceStatus != ''"> and hd.device_status = #{deviceStatus}</if>
|
|
|
|
|
<if test="activeTime != null "> and hd.active_time = #{activeTime}</if>
|
|
|
|
|
<if test="devicePic != null and devicePic != ''"> and hd.device_pic = #{devicePic}</if>
|
|
|
|
|
<if test="ipAddress != null and ipAddress != ''"> and hd.ip_address = #{ipAddress}</if>
|
|
|
|
|
<if test="areaId != null "> and hd.area_id = #{areaId}</if>
|
|
|
|
|
<if test="deviceLocation != null and deviceLocation != ''"> and hd.device_location = #{deviceLocation}</if>
|
|
|
|
|
<if test="currentModuleVersion != null and currentModuleVersion != ''"> and hd.current_module_version = #{currentModuleVersion}</if>
|
|
|
|
|
<if test="currentSinglechipVersion != null and currentSinglechipVersion != ''"> and hd.current_singlechip_version = #{currentSinglechipVersion}</if>
|
|
|
|
|
<if test="deviceField != null and deviceField != ''"> and hd.device_field = #{deviceField}</if>
|
|
|
|
|
<if test="tenantId != null "> and hd.tenant_id = #{tenantId}</if>
|
|
|
|
|
<if test="onlineStatus != null and onlineStatus != ''"> and hd.online_status = #{onlineStatus}</if>
|
|
|
|
|
<!-- 租户数据范围过滤 -->
|
|
|
|
|
${params.tenantDataScope}
|
|
|
|
|
</where>
|
|
|
|
@ -131,7 +162,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
|
|
|
|
|
<select id="selectHwDeviceByDeviceId" parameterType="Long" resultMap="HwDeviceResult">
|
|
|
|
|
<include refid="selectHwDeviceVo"/>
|
|
|
|
|
where device_id = #{deviceId}
|
|
|
|
|
where hd.device_id = #{deviceId}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertHwDevice" parameterType="HwDevice" useGeneratedKeys="true" keyProperty="deviceId">
|
|
|
|
@ -305,7 +336,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
|
|
|
|
|
<select id="selectHwDeviceByDeviceCode" parameterType="String" resultMap="HwDeviceResult">
|
|
|
|
|
<include refid="selectHwDeviceVo"/>
|
|
|
|
|
where device_code = #{deviceCode} limit 1
|
|
|
|
|
where hd.device_code = #{deviceCode} limit 1
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -328,10 +359,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
<select id="selectHwDeviceListByMonitor" parameterType="HwDevice" resultMap="HwDeviceResult">
|
|
|
|
|
<include refid="selectHwDeviceVo"/>
|
|
|
|
|
<where>
|
|
|
|
|
<if test="sceneId != null "> and scene_id = #{sceneId}</if>
|
|
|
|
|
<if test="monitorUnitId != null "> and monitor_unit_id = #{monitorUnitId}</if>
|
|
|
|
|
<if test="sceneId != null "> and hd.scene_id = #{sceneId}</if>
|
|
|
|
|
<if test="monitorUnitId != null "> and hd.monitor_unit_id = #{monitorUnitId}</if>
|
|
|
|
|
|
|
|
|
|
and device_status !='9' and (device_type='2' or device_type='3')
|
|
|
|
|
and hd.device_status !='9' and (device_type='2' or device_type='3')
|
|
|
|
|
<!-- 租户数据范围过滤 -->
|
|
|
|
|
${params.tenantDataScope}
|
|
|
|
|
</where>
|
|
|
|
@ -404,10 +435,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
where ha.area_id = ha2.parent_id and ha.area_id = #{areaId}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="getDeviceListInMonitorUnit" parameterType="Long" resultMap="HwDeviceResult">
|
|
|
|
|
select * from hw_device hd where device_mode_id in
|
|
|
|
|
(select device_mode_id from hw_device_mode_function hdmf where function_identifier ='latitude')
|
|
|
|
|
and device_status !=9
|
|
|
|
|
and monitor_unit_id = #{monitorUnitId}
|
|
|
|
|
SELECT hd.*, hmu.monitor_unit_name
|
|
|
|
|
FROM hw_device hd
|
|
|
|
|
LEFT JOIN hw_monitor_unit hmu ON hmu.monitor_unit_id = hd.monitor_unit_id
|
|
|
|
|
WHERE hd.device_mode_id IN (
|
|
|
|
|
SELECT hdmf.device_mode_id
|
|
|
|
|
FROM hw_device_mode_function hdmf
|
|
|
|
|
WHERE hdmf.function_identifier = 'latitude'
|
|
|
|
|
)
|
|
|
|
|
AND hd.device_status != 9
|
|
|
|
|
AND hd.monitor_unit_id = #{monitorUnitId}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectFunctionNameByFunctionIdentifier" parameterType="String" resultType="String">
|
|
|
|
|
select distinct function_name from hw_device_mode_function where function_identifier = #{functionIdentifier}
|
|
|
|
|