|
|
|
@ -32,18 +32,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
<result property="updateBy" column="update_by" />
|
|
|
|
|
<result property="updateTime" column="update_time" />
|
|
|
|
|
<result property="deviceField" column="device_field" />
|
|
|
|
|
<result property="tenantId" column="tenant_id" />
|
|
|
|
|
<result property="onlineStatus" column="online_status" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<!--以下为监控平台接口所用-->
|
|
|
|
|
<resultMap id="DeviceModeVoResult" type="com.ruoyi.business.domain.VO.DeviceModeVo" >
|
|
|
|
|
<result property="deviceModeName" column="device_mode_name"/>
|
|
|
|
|
<result property="sum" column="sum"/>
|
|
|
|
|
<result property="err" column="err"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<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 from hw_device
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectDeviceModeNameVo" resultMap="DeviceModeVoResult">
|
|
|
|
|
SELECT b.device_mode_name ,a.sum FROM hw_device_mode b
|
|
|
|
|
LEFT JOIN (SELECT device_mode_id,count(*) as sum FROM hw_device GROUP BY device_mode_id order by sum desc
|
|
|
|
@ -62,7 +60,7 @@ LEFT JOIN (SELECT device_mode_id,count(*) as sum FROM hw_device GROUP BY device_
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectDeviceByMonitorId" parameterType="Long" resultMap="HwDeviceResult">
|
|
|
|
|
<include refid="selectHwDeviceVo"/>
|
|
|
|
|
from hw_device where monitor_unit_id = #{monitorUnitId}
|
|
|
|
|
where monitor_unit_id = #{monitorUnitId}
|
|
|
|
|
</select>
|
|
|
|
|
<select id="selectDeviceByDeviceModeBySceneId" parameterType="Long" resultMap="HwDeviceResult">
|
|
|
|
|
select * from hw_device where device_mode_id = (
|
|
|
|
@ -72,6 +70,12 @@ SELECT device_mode_id from hw_device_mode where scene_id = #{sceneId} )
|
|
|
|
|
select * from hw_device where device_mode_id = (
|
|
|
|
|
SELECT device_mode_id from hw_device_mode where monitor_unit_id = #{monitorUnitId} )
|
|
|
|
|
</select>
|
|
|
|
|
<!--以上为监控平台接口所用-->
|
|
|
|
|
|
|
|
|
|
<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
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectHwDeviceList" parameterType="HwDevice" resultMap="HwDeviceResult">
|
|
|
|
|
<include refid="selectHwDeviceVo"/>
|
|
|
|
|
<where>
|
|
|
|
@ -96,6 +100,8 @@ SELECT device_mode_id from hw_device_mode where monitor_unit_id = #{monitorUnitI
|
|
|
|
|
<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>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
@ -133,6 +139,8 @@ SELECT device_mode_id from hw_device_mode where monitor_unit_id = #{monitorUnitI
|
|
|
|
|
<if test="updateBy != null">update_by,</if>
|
|
|
|
|
<if test="updateTime != null">update_time,</if>
|
|
|
|
|
<if test="deviceField != null">device_field,</if>
|
|
|
|
|
<if test="tenantId != null">tenant_id,</if>
|
|
|
|
|
<if test="onlineStatus != null and onlineStatus != ''">online_status,</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="deviceCode != null and deviceCode != ''">#{deviceCode},</if>
|
|
|
|
@ -161,6 +169,8 @@ SELECT device_mode_id from hw_device_mode where monitor_unit_id = #{monitorUnitI
|
|
|
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
|
|
<if test="deviceField != null">#{deviceField},</if>
|
|
|
|
|
<if test="tenantId != null">#{tenantId},</if>
|
|
|
|
|
<if test="onlineStatus != null and onlineStatus != ''">#{onlineStatus},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
@ -193,6 +203,8 @@ SELECT device_mode_id from hw_device_mode where monitor_unit_id = #{monitorUnitI
|
|
|
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
|
|
<if test="deviceField != null">device_field = #{deviceField},</if>
|
|
|
|
|
<if test="tenantId != null">tenant_id = #{tenantId},</if>
|
|
|
|
|
<if test="onlineStatus != null and onlineStatus != ''">online_status = #{onlineStatus},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where device_id = #{deviceId}
|
|
|
|
|
</update>
|
|
|
|
|