|
|
|
@ -35,6 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
<result property="slaveId" column="slave_id" />
|
|
|
|
|
<result property="transport" column="transport" />
|
|
|
|
|
<result property="guid" column="guid" />
|
|
|
|
|
<result property="devParams" column="dev_params" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<resultMap type="com.fastbee.iot.model.DeviceShortOutput" id="DeviceShortResult">
|
|
|
|
@ -63,6 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
<result property="protocolCode" column="protocol_code"/>
|
|
|
|
|
<result property="transport" column="transport" />
|
|
|
|
|
<result property="guid" column="guid" />
|
|
|
|
|
<result property="devParams" column="dev_params" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<resultMap type="com.fastbee.iot.model.DeviceAllShortOutput" id="DeviceAllShortResult">
|
|
|
|
@ -83,6 +85,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
<result property="latitude" column="latitude" />
|
|
|
|
|
<result property="isOwner" column="is_owner" />
|
|
|
|
|
<result property="subDeviceCount" column="sub_device_count"/>
|
|
|
|
|
<result property="devParams" column="dev_params" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<resultMap type="com.fastbee.iot.model.UserAndTenant" id="UserAndTenantResult">
|
|
|
|
@ -161,15 +164,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectDeviceVo">
|
|
|
|
|
select device_id, device_name, product_id, product_name, tenant_id, tenant_name, serial_number,gw_dev_code, firmware_version, status, rssi,is_shadow ,is_simulate,location_way,things_model_value,network_address, network_ip, longitude, latitude, active_time, create_time, update_time, img_url,summary,remark,slave_id from iot_device
|
|
|
|
|
select
|
|
|
|
|
* from iot_device
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<sql id="selectDeviceShortVo">
|
|
|
|
|
select device_id, device_name, product_id, product_name, tenant_id, tenant_name, serial_number, firmware_version, status,rssi,is_shadow ,is_simulate,location_way,things_model_value, active_time,img_url,slave_id from iot_device
|
|
|
|
|
select * from iot_device
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<sql id="selectWebhookDeviceVo">
|
|
|
|
|
select device_id, device_name,product_id, serial_number,tenant_id, tenant_name, status,is_shadow,is_simulate, rssi ,location_way,things_model_value, active_time from iot_device
|
|
|
|
|
select * from iot_device
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectDeviceList" parameterType="com.fastbee.iot.domain.Device" resultMap="DeviceResult">
|
|
|
|
@ -199,7 +203,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
|
|
|
|
|
<select id="selectUnAuthDeviceList" parameterType="com.fastbee.iot.domain.Device" resultMap="DeviceResult">
|
|
|
|
|
select d.device_id, d.device_name, d.product_id, d.product_name, d.tenant_id, d.tenant_name,
|
|
|
|
|
d.serial_number,d.gw_dev_code, d.firmware_version, d.status,d.is_shadow,d.is_simulate ,d.location_way,d.active_time, d.img_url,a.device_id as auth_device_id
|
|
|
|
|
d.serial_number,d.gw_dev_code,d.dev_params, d.firmware_version, d.status,d.is_shadow,d.is_simulate ,d.location_way,d.active_time, d.img_url,a.device_id as auth_device_id
|
|
|
|
|
from iot_device d
|
|
|
|
|
left join iot_product_authorize a on a.device_id=d.device_id
|
|
|
|
|
<where>
|
|
|
|
@ -226,7 +230,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectDeviceListByGroup" parameterType="com.fastbee.iot.domain.Device" resultMap="DeviceResult">
|
|
|
|
|
select d.device_id, d.device_name, d.product_name, d.serial_number,d.gw_dev_code, d.firmware_version, d.status,d.rssi,d.is_shadow ,
|
|
|
|
|
select d.device_id, d.device_name, d.dev_params, d.product_name, d.serial_number,d.gw_dev_code, d.firmware_version, d.status,d.rssi,d.is_shadow ,
|
|
|
|
|
d.location_way, d.active_time,d.network_address,d.longitude,d.latitude
|
|
|
|
|
from iot_device d
|
|
|
|
|
<where>
|
|
|
|
@ -253,7 +257,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectAllDeviceShortList" parameterType="com.fastbee.iot.domain.Device" resultMap="DeviceAllShortResult">
|
|
|
|
|
select d.device_id, d.device_name, d.product_name,p.device_type, d.tenant_name, d.serial_number,d.gw_dev_code, d.firmware_version, d.status,d.rssi,d.is_shadow ,
|
|
|
|
|
select d.device_id, d.device_name,d.dev_params, d.product_name,p.device_type, d.tenant_name, d.serial_number,d.gw_dev_code, d.firmware_version, d.status,d.rssi,d.is_shadow ,
|
|
|
|
|
d.location_way, d.active_time,d.network_address,d.longitude,d.latitude
|
|
|
|
|
from iot_device d
|
|
|
|
|
left join iot_product p on p.product_id=d.product_id
|
|
|
|
@ -288,7 +292,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<select id="selectDeviceShortList" parameterType="com.fastbee.iot.domain.Device" resultMap="DeviceShortResult">
|
|
|
|
|
select d.device_id, d.device_name, p.product_id, p.product_name,p.device_type,
|
|
|
|
|
select d.device_id, d.device_name, d.dev_params, p.product_id, p.product_name,p.device_type,
|
|
|
|
|
d.tenant_id, d.tenant_name, d.serial_number,d.gw_dev_code,
|
|
|
|
|
d.firmware_version, d.status,d.rssi,d.is_shadow,d.is_simulate ,d.location_way,
|
|
|
|
|
d.things_model_value, d.active_time,d.create_time, if(null = d.img_url or '' = d.img_url, p.img_url, d.img_url) as img_url,
|
|
|
|
@ -333,7 +337,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectDeviceByDeviceId" parameterType="Long" resultMap="DeviceResult">
|
|
|
|
|
select d.device_id, d.device_name, d.product_id, p.product_name,p.device_type, d.tenant_id, d.tenant_name,
|
|
|
|
|
select d.device_id, d.device_name, d.dev_params, d.product_id, p.product_name,p.device_type, d.tenant_id, d.tenant_name,
|
|
|
|
|
d.serial_number, d.firmware_version, d.status, d.rssi,d.is_shadow,d.is_simulate ,d.location_way,d.things_model_value,
|
|
|
|
|
d.network_address, d.network_ip, d.longitude, d.latitude, d.active_time, d.create_time, d.update_time,
|
|
|
|
|
d.img_url,d.summary,d.remark,p.guid from iot_device d
|
|
|
|
@ -499,6 +503,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
<if test="gwDevCode != null">gw_dev_code,</if>
|
|
|
|
|
<if test="isSimulate != null">is_simulate,</if>
|
|
|
|
|
<if test="slaveId != null">slave_id,</if>
|
|
|
|
|
<if test="devParams != null">dev_params,</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="deviceName != null and deviceName != ''">#{deviceName},</if>
|
|
|
|
@ -529,11 +534,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
<if test="gwDevCode != null">#{gwDevCode},</if>
|
|
|
|
|
<if test="isSimulate != null">#{isSimulate},</if>
|
|
|
|
|
<if test="slaveId != null">#{slaveId},</if>
|
|
|
|
|
<if test="devParams != null">#{devParams},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<insert id="insertBatchDevice" parameterType="com.fastbee.iot.domain.Device" useGeneratedKeys="true" keyProperty="deviceId">
|
|
|
|
|
insert into iot_device (device_name, product_id, product_name, tenant_id, tenant_name, serial_number, firmware_version, rssi, is_shadow, location_way, create_by, create_time)
|
|
|
|
|
insert into iot_device (device_name, product_id, product_name, tenant_id, tenant_name, serial_number, firmware_version, rssi, is_shadow, location_way,dev_params, create_by, create_time)
|
|
|
|
|
values
|
|
|
|
|
<foreach collection="deviceList" item="device" separator=",">
|
|
|
|
|
(#{device.deviceName},
|
|
|
|
@ -545,6 +551,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
#{device.firmwareVersion},
|
|
|
|
|
#{device.rssi},
|
|
|
|
|
#{device.isShadow},
|
|
|
|
|
#{device.devParams},
|
|
|
|
|
#{device.locationWay},
|
|
|
|
|
#{device.createBy},
|
|
|
|
|
sysdate())
|
|
|
|
@ -582,6 +589,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
<if test="imgUrl != null">img_url = #{imgUrl},</if>
|
|
|
|
|
<if test="summary != null">summary = #{summary},</if>
|
|
|
|
|
<if test="slaveId != null">slave_id = #{slaveId},</if>
|
|
|
|
|
<if test="devParams != null">dev_params = #{devParams},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where device_id = #{deviceId}
|
|
|
|
|
</update>
|
|
|
|
@ -642,6 +650,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
<if test="imgUrl != null">img_url = #{imgUrl},</if>
|
|
|
|
|
<if test="summary != null">summary = #{summary},</if>
|
|
|
|
|
<if test="gwDevCode != null">gw_dev_code = #{gwDevCode},</if>
|
|
|
|
|
<if test="devParams != null">dev_params = #{devParams},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where serial_number = #{serialNumber}
|
|
|
|
|
</update>
|
|
|
|
@ -790,7 +799,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
select d.device_id, d.device_name, d.product_id, d.product_name,p.device_type,
|
|
|
|
|
d.tenant_id, d.tenant_name, d.serial_number,d.gw_dev_code,
|
|
|
|
|
d.firmware_version, d.status,d.rssi,d.is_shadow,d.is_simulate ,d.location_way,
|
|
|
|
|
d.things_model_value, d.active_time,d.create_time,d.img_url,
|
|
|
|
|
d.things_model_value, d.active_time,d.create_time,d.img_url,d.dev_params,
|
|
|
|
|
(select count(*) from iot_device d1 where d1.gw_dev_code = d.serial_number) as sub_device_count,
|
|
|
|
|
p.protocol_code,p.transport, u.is_owner
|
|
|
|
|
from (
|
|
|
|
@ -857,7 +866,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
|
|
|
|
|
<select id="listTerminalUserByGroup" resultType="com.fastbee.iot.domain.Device">
|
|
|
|
|
select d.device_id, d.device_name, d.product_name, d.serial_number,d.gw_dev_code, d.firmware_version, d.status,d.rssi,d.is_shadow ,
|
|
|
|
|
d.location_way, d.active_time,d.network_address,d.longitude,d.latitude
|
|
|
|
|
d.location_way, d.active_time,d.dev_params,d.network_address,d.longitude,d.latitude
|
|
|
|
|
from (
|
|
|
|
|
select device_id, 1 AS is_owner
|
|
|
|
|
from iot_device_user
|
|
|
|
|