设备增加管护

This commit is contained in:
wuyw 2024-08-15 08:34:29 +08:00
parent c86a631cc5
commit 498f77bc80
4 changed files with 58 additions and 7 deletions

View File

@ -178,6 +178,12 @@ public class Device extends BaseEntity
@ApiModelProperty("设备参数")
private String devParams;
@ApiModelProperty("管护人")
private String caretaker;
@ApiModelProperty("管护单位")
private String managementUnit;
@ApiModelProperty("联系电话")
private String tel;
/**
* 关联组态,来源产品

View File

@ -1,6 +1,7 @@
package com.fastbee.iot.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
import java.util.Date;
@ -66,6 +67,12 @@ public class DeviceAllShortOutput
private Integer isOwner;
private Integer subDeviceCount;
@ApiModelProperty("管护人")
private String caretaker;
@ApiModelProperty("管护单位")
private String managementUnit;
@ApiModelProperty("联系电话")
private String tel;
public Integer getSubDeviceCount() {
return subDeviceCount;

View File

@ -94,6 +94,13 @@ public class DeviceShortOutput
@Excel(name = "网关设备编号(子设备使用)")
private String gwDevCode;
@ApiModelProperty("管护人")
private String caretaker;
@ApiModelProperty("管护单位")
private String managementUnit;
@ApiModelProperty("联系电话")
private String tel;
/** 是否自定义位置 **/
private Integer locationWay;

View File

@ -36,6 +36,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="transport" column="transport" />
<result property="guid" column="guid" />
<result property="devParams" column="dev_params" />
<result property="tel" column="tel" />
<result property="caretaker" column="caretaker" />
<result property="managementUnit" column="management_unit" />
</resultMap>
<resultMap type="com.fastbee.iot.model.DeviceShortOutput" id="DeviceShortResult">
@ -65,6 +68,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="transport" column="transport" />
<result property="guid" column="guid" />
<result property="devParams" column="dev_params" />
<result property="tel" column="tel" />
<result property="caretaker" column="caretaker" />
<result property="managementUnit" column="management_unit" />
</resultMap>
<resultMap type="com.fastbee.iot.model.DeviceAllShortOutput" id="DeviceAllShortResult">
@ -86,6 +92,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="isOwner" column="is_owner" />
<result property="subDeviceCount" column="sub_device_count"/>
<result property="devParams" column="dev_params" />
<result property="tel" column="tel" />
<result property="caretaker" column="caretaker" />
<result property="managementUnit" column="management_unit" />
</resultMap>
<resultMap type="com.fastbee.iot.model.UserAndTenant" id="UserAndTenantResult">
@ -203,7 +212,9 @@ 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.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
d.management_unit, d.caretaker, d.tel,
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>
@ -230,7 +241,9 @@ 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.dev_params, 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.management_unit, d.caretaker, d.tel,
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>
@ -257,7 +270,9 @@ 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.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 ,
select d.device_id, d.device_name,d.dev_params, d.product_name,p.device_type,
d.management_unit, d.caretaker, d.tel,
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
@ -307,7 +322,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDeviceShortList" parameterType="com.fastbee.iot.domain.Device" resultMap="DeviceShortResult">
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.tenant_id, d.tenant_name, d.serial_number,d.gw_dev_code,d.management_unit, d.caretaker, d.tel,
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,
case
@ -352,7 +367,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectDeviceByDeviceId" parameterType="Long" resultMap="DeviceResult">
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.serial_number, d.management_unit, d.caretaker, d.tel,
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
left join iot_product p on p.product_id=d.product_id
@ -518,6 +534,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isSimulate != null">is_simulate,</if>
<if test="slaveId != null">slave_id,</if>
<if test="devParams != null">dev_params,</if>
<if test="managementUnit != null">management_unit,</if>
<if test="caretaker != null">caretaker,</if>
<if test="tel != null">tel,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deviceName != null and deviceName != ''">#{deviceName},</if>
@ -549,11 +568,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isSimulate != null">#{isSimulate},</if>
<if test="slaveId != null">#{slaveId},</if>
<if test="devParams != null">#{devParams},</if>
<if test="managementUnit != null">#{managementUnit},</if>
<if test="caretaker != null">#{caretaker},</if>
<if test="tel != null">#{tel},</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,dev_params, 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},
@ -604,6 +627,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="summary != null">summary = #{summary},</if>
<if test="slaveId != null">slave_id = #{slaveId},</if>
<if test="devParams != null">dev_params = #{devParams},</if>
<if test="managementUnit != null">management_unit = #{managementUnit},</if>
<if test="caretaker != null">caretaker = #{caretaker},</if>
<if test="tel != null">tel = #{tel},</if>
</trim>
where device_id = #{deviceId}
</update>
@ -665,6 +691,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="summary != null">summary = #{summary},</if>
<if test="gwDevCode != null">gw_dev_code = #{gwDevCode},</if>
<if test="devParams != null">dev_params = #{devParams},</if>
<if test="managementUnit != null">management_unit = #{managementUnit},</if>
<if test="caretaker != null">caretaker = #{caretaker},</if>
<if test="tel != null">tel = #{tel},</if>
</trim>
where serial_number = #{serialNumber}
</update>
@ -812,6 +841,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="listTerminalUser" parameterType="com.fastbee.iot.domain.Device" resultMap="DeviceShortResult">
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.management_unit, d.caretaker, d.tel,
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.dev_params,
(select count(*) from iot_device d1 where d1.gw_dev_code = d.serial_number) as sub_device_count,
@ -879,7 +909,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<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 ,
select d.device_id, d.device_name, d.product_name, d.serial_number,d.gw_dev_code,
d.management_unit, d.caretaker, d.tel,d.firmware_version, d.status,d.rssi,d.is_shadow ,
d.location_way, d.active_time,d.dev_params,d.network_address,d.longitude,d.latitude
from (
select device_id, 1 AS is_owner