提交修改

This commit is contained in:
LEED
2025-04-13 18:00:19 +08:00
parent 988e68bdc7
commit 4201690d93
60 changed files with 2589 additions and 285 deletions

View File

@@ -37,6 +37,14 @@
<result property="guid" column="guid"/>
<result property="groupId" column="group_id"/>
<result property="agenciesId" column="agencies_id"/>
<result property="icWay" column="ic_way"/>
<result property="iccid" column="iccid"/>
<result property="volt" column="volt"/>
<result property="sd" column="sd"/>
<result property="pd" column="pd"/>
<result property="imei" column="imei"/>
<result property="gwId" column="gw_id"/>
<result property="gwName" column="gw_name"/>
</resultMap>
<resultMap type="com.xinda.iot.model.DeviceShortOutput" id="DeviceShortResult">
@@ -67,6 +75,14 @@
<result property="guid" column="guid"/>
<result property="groupId" column="group_id"/>
<result property="agenciesId" column="agencies_id"/>
<result property="icWay" column="ic_way"/>
<result property="iccid" column="iccid"/>
<result property="volt" column="volt"/>
<result property="sd" column="sd"/>
<result property="pd" column="pd"/>
<result property="imei" column="imei"/>
<result property="gwId" column="gw_id"/>
<result property="gwName" column="gw_name"/>
</resultMap>
<resultMap type="com.xinda.iot.model.DeviceAllShortOutput" id="DeviceAllShortResult">
@@ -87,6 +103,14 @@
<result property="latitude" column="latitude"/>
<result property="isOwner" column="is_owner"/>
<result property="subDeviceCount" column="sub_device_count"/>
<result property="icWay" column="ic_way"/>
<result property="iccid" column="iccid"/>
<result property="volt" column="volt"/>
<result property="sd" column="sd"/>
<result property="pd" column="pd"/>
<result property="imei" column="imei"/>
<result property="gwId" column="gw_id"/>
<result property="gwName" column="gw_name"/>
</resultMap>
<resultMap type="com.xinda.iot.model.UserAndTenant" id="UserAndTenantResult">
@@ -192,7 +216,13 @@
img_url,
summary,
remark,
slave_id,group_id,agencies_id
slave_id,
group_id,
agencies_id,
ic_way,
iccid,
volt,
sd,pd,imei, gw_id, gw_name
from iot_device
</sql>
@@ -213,7 +243,12 @@
things_model_value,
active_time,
img_url,
slave_id,group_id,agencies_id
slave_id,
group_id,
agencies_id,
ic_way,
iccid,
volt,sd,pd,imei, gw_id, gw_name
from iot_device
</sql>
@@ -230,7 +265,9 @@
rssi,
location_way,
things_model_value,
active_time,group_id,agencies_id
active_time,
group_id,
agencies_id
from iot_device
</sql>
@@ -263,6 +300,8 @@
<if test="params.beginActiveTime != null and params.beginActiveTime != '' and params.endActiveTime != null and params.endActiveTime != ''">
and active_time between #{params.beginActiveTime} and #{params.endActiveTime}
</if>
<if test="gwId != null "> and gw_id = #{gwId}</if>
<if test="gwName != null and gwName != ''"> and gw_name like concat('%', #{gwName}, '%')</if>
</where>
order by create_time desc
</select>
@@ -305,8 +344,8 @@
<select id="selectDeviceListByGroup" parameterType="com.xinda.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 ,
d.location_way, d.active_time,d.network_address,d.longitude,d.latitude
from iot_device d
d.location_way, d.active_time,d.network_address,d.longitude,d.latitude, d.ic_way,d.iccid,d.volt,d.sd,d.pd,d.imei, d.gw_id, d.gw_name
from iot_device d,sd,pd
<where>
<if test="productId != null ">and d.product_id = #{productId}</if>
<if test="deviceName != null and deviceName != ''">and d.device_name like concat('%', #{deviceName}, '%')
@@ -340,7 +379,7 @@
<select id="selectAllDeviceShortList" parameterType="com.xinda.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 ,
d.location_way, d.active_time,d.network_address,d.longitude,d.latitude
d.location_way, d.active_time,d.network_address,d.longitude,d.latitude,d.ic_way,d.iccid,d.volt,d.sd,d.pd,d.imei, d.gw_id, d.gw_name
from iot_device d
left join iot_product p on p.product_id=d.product_id
<where>
@@ -354,6 +393,7 @@
<if test="deptId != null and deptId != 0 and showChild != null and !showChild">
and d.tenant_id = (SELECT dept_user_id FROM sys_dept WHERE dept_id = #{deptId})
</if>
<if test="gwId != null "> and d.gw_id = #{gwId}</if>
</where>
group by d.device_id,d.tenant_id
</select>
@@ -398,7 +438,7 @@
<select id="selectDeviceGShortList" parameterType="com.xinda.iot.domain.Device" resultMap="DeviceShortResult">
select d.device_id, d.device_name, 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.firmware_version, d.status,d.rssi,d.is_shadow,d.is_simulate ,d.location_way,d.ic_way,d.iccid,d.volt,d.sd,d.pd,d.imei, d.gw_id, d.gw_name,
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
@@ -429,7 +469,7 @@
<if test="agenciesId == null">and d.agencies_id IS NULL</if>
<if test="agenciesId != null">and d.agencies_id = #{agenciesId}</if>
<!-- <if test="groupIdExclude != null">and d.group_id != #{groupIdExclude}</if>-->
<if test="gwId != null "> and d.gw_id = #{gwId}</if>
<if test="deptId != null and deptId != 0 and showChild != null and showChild ">
and
( d.tenant_id in (SELECT u.user_id FROM sys_user u
@@ -500,7 +540,7 @@
<select id="selectDeviceShortList" parameterType="com.xinda.iot.domain.Device" resultMap="DeviceShortResult">
select d.device_id, d.device_name, 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.firmware_version, d.status,d.rssi,d.is_shadow,d.is_simulate ,d.location_way,d.ic_way,d.iccid,d.volt,d.sd,d.pd,d.imei, d.gw_id, d.gw_name,
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
when (select count(*) from iot_device_share du where du.device_id = d.device_id and du.user_id = #{tenantId}) then 0
@@ -522,24 +562,115 @@
<if test="gwDevCode != null and gwDevCode != ''"> and d.gw_dev_code = #{gwDevCode}</if>
<if test="status != null "> and d.status = #{status}</if>
<if test="isSimulate != null">and d.is_simulate = #{isSimulate}</if>
<if test="gwId != null "> and d.gw_id = #{gwId}</if>
<if test="deptId != null and deptId != 0 ">
and
( d.agencies_id in (SELECT de.dept_id FROM sys_dept de
WHERE FIND_IN_SET(#{deptId}, de.ancestors) OR de.dept_id = #{deptId})
)
</if>
<!-- <if test="deptId != null and deptId != 0 and showChild != null and !showChild">-->
<!-- and (-->
<!-- d.agencies_id = (SELECT dept_user_id FROM sys_dept WHERE dept_id = #{deptId})-->
<!-- or d.device_id in (select du.device_id from iot_device_share du where du.user_id = #{tenantId})-->
<!-- )-->
<!-- </if>-->
<if test="params.beginActiveTime != null and params.beginActiveTime != '' and params.endActiveTime != null and params.endActiveTime != ''"> and d.active_time between #{params.beginActiveTime} and #{params.endActiveTime}</if>
</where>
group by d.device_id,d.tenant_id
order by d.create_time desc
</select>
<select id="selectDeviceShortGwList" parameterType="com.xinda.iot.domain.Device" resultMap="DeviceShortResult">
select d.device_id, d.device_name, 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.ic_way,d.iccid,d.volt,d.sd,d.pd,d.imei, d.gw_id, d.gw_name,
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
when (select count(*) from iot_device_share du where du.device_id = d.device_id and du.user_id = #{tenantId}) then 0
else 1
end as is_owner,
(select count(*) from iot_device d1 where d1.gw_dev_code = d.serial_number) as sub_device_count,
p.protocol_code,p.transport,p.guid
from iot_device d
left join iot_product p on p.product_id=d.product_id
<if test="groupId != null and groupId !=0 "> left join iot_device_group g on g.device_id=d.device_id </if>
<where>
p.device_type != 3
and d.del_flag = '0'
<if test="groupId != null and groupId !=0 "> and g.group_id = #{groupId}</if>
<if test="deviceName != null and deviceName != ''"> and d.device_name like concat('%', #{deviceName}, '%')</if>
<if test="productId != null "> and d.product_id = #{productId}</if>
<if test="productName != null and productName != ''"> and d.product_name like concat('%', #{productName}, '%')</if>
<if test="serialNumber != null and serialNumber != ''"> and d.serial_number = #{serialNumber}</if>
<if test="gwDevCode != null and gwDevCode != ''"> and d.gw_dev_code = #{gwDevCode}</if>
<if test="status != null "> and d.status = #{status}</if>
<if test="isSimulate != null">and d.is_simulate = #{isSimulate}</if>
<if test="gwId != null "> and d.gw_id = #{gwId}</if>
<if test="deptId != null and deptId != 0 ">
and
( d.agencies_id in (SELECT de.dept_id FROM sys_dept de
WHERE FIND_IN_SET(#{deptId}, de.ancestors) OR de.dept_id = #{deptId})
)
</if>
<if test="params.beginActiveTime != null and params.beginActiveTime != '' and params.endActiveTime != null and params.endActiveTime != ''"> and d.active_time between #{params.beginActiveTime} and #{params.endActiveTime}</if>
</where>
group by d.device_id,d.tenant_id
order by d.create_time desc
</select>
<select id="selectDeviceShortTreeList" parameterType="com.xinda.iot.domain.Device" resultMap="DeviceShortResult">
select d.device_id, d.device_name, 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.ic_way,d.iccid,d.volt,d.sd,d.pd,d.imei, d.gw_id, d.gw_name,
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
when (select count(*) from iot_device_share du where du.device_id = d.device_id and du.user_id = #{tenantId}) then 0
else 1
end as is_owner,
(select count(*) from iot_device d1 where d1.gw_dev_code = d.serial_number) as sub_device_count,
p.protocol_code,p.transport,p.guid
from iot_device d
left join iot_product p on p.product_id=d.product_id
<if test="groupId != null and groupId !=0 "> left join iot_device_group g on g.device_id=d.device_id </if>
<where>
and d.del_flag = '0'
<if test="groupId != null and groupId !=0 "> and g.group_id = #{groupId}</if>
<if test="deviceName != null and deviceName != ''"> and d.device_name like concat('%', #{deviceName}, '%')</if>
<if test="productId != null "> and d.product_id = #{productId}</if>
and (p.device_type == 2 or p.device_type == 1 )
<if test="productName != null and productName != ''"> and d.product_name like concat('%', #{productName}, '%')</if>
<if test="serialNumber != null and serialNumber != ''"> and d.serial_number = #{serialNumber}</if>
<if test="gwDevCode != null and gwDevCode != ''"> and d.gw_dev_code = #{gwDevCode}</if>
<if test="status != null "> and d.status = #{status}</if>
<if test="isSimulate != null">and d.is_simulate = #{isSimulate}</if>
<if test="gwId != null "> and d.gw_id = #{gwId}</if>
<if test="deptId != null and deptId != 0 ">
and
( d.agencies_id in (SELECT de.dept_id FROM sys_dept de
WHERE FIND_IN_SET(#{deptId}, de.ancestors) OR de.dept_id = #{deptId})
)
</if>
<if test="params.beginActiveTime != null and params.beginActiveTime != '' and params.endActiveTime != null and params.endActiveTime != ''"> and d.active_time between #{params.beginActiveTime} and #{params.endActiveTime}</if>
</where>
group by d.device_id,d.tenant_id
order by d.create_time desc
</select>
<select id="selectCamDeviceListByDeviceId" parameterType="Long" resultMap="DeviceShortResult">
select d.device_id, d.device_name, 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.ic_way,d.iccid,d.volt,d.sd,d.pd,d.imei, d.gw_id, d.gw_name,
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,
(select count(*) from iot_device d1 where d1.gw_dev_code = d.serial_number) as sub_device_count,
p.protocol_code,p.transport,p.guid
from iot_device d
left join iot_product p on p.product_id=d.product_id
<where>
and d.del_flag = '0'
and
( d.device_id in ( select sd.sip_id from iot_sip_device sd where sd.device_id = #{deviceId} )
)
</where>
group by d.device_id,d.tenant_id
order by d.create_time desc
</select>
<select id="selectDeviceByDeviceId" parameterType="Long" resultMap="DeviceResult">
select d.device_id,
d.device_name,
@@ -568,7 +699,10 @@
d.remark,
p.guid,
d.group_id,
d.agencies_id
d.agencies_id,
d.ic_way,
d.iccid,
d.volt,d.sd,d.pd,d.imei, d.gw_id, d.gw_name
from iot_device d
left join iot_product p on p.product_id = d.product_id
@@ -749,6 +883,14 @@
<if test="slaveId != null">slave_id,</if>
<if test="groupId != null">group_id,</if>
<if test="agenciesId != null">agencies_id,</if>
<if test="icWay != null">ic_way,</if>
<if test="iccid != null">iccid,</if>
<if test="volt != null">volt,</if>
<if test="sd != null">sd,</if>
<if test="pd != null">pd,</if>
<if test="imei != null">imei,</if>
<if test="gwId != null">gw_id,</if>
<if test="gwName != null">gw_name,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deviceName != null and deviceName != ''">#{deviceName},</if>
@@ -781,13 +923,21 @@
<if test="slaveId != null">#{slaveId},</if>
<if test="groupId != null">#{groupId},</if>
<if test="agenciesId != null">#{agenciesId},</if>
<if test="icWay != null">#{icWay},</if>
<if test="iccid != null">#{iccid},</if>
<if test="volt != null">#{volt},</if>
<if test="sd != null">#{sd},</if>
<if test="pd != null">#{pd},</if>
<if test="imei != null">#{imei},</if>
<if test="gwId != null">#{gwId},</if>
<if test="gwName != null">#{gwName},</if>
</trim>
</insert>
<insert id="insertBatchDevice" parameterType="com.xinda.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)
firmware_version, rssi, is_shadow, location_way, create_by, create_time,ic_way,iccid,volt,sd,pd,imei, gw_id, gw_name)
values
<foreach collection="deviceList" item="device" separator=",">
(#{device.deviceName},
@@ -801,7 +951,15 @@
#{device.isShadow},
#{device.locationWay},
#{device.createBy},
sysdate())
sysdate(),
#{device.icWay},
#{device.iccid},
#{device.volt}),
#{device.sd}),
#{device.pd}),
#{device.imei}),
#{device.gwId}),
#{device.geName})
</foreach>
</insert>
@@ -838,6 +996,14 @@
<if test="slaveId != null">slave_id = #{slaveId},</if>
<if test="groupId != null">group_id = #{groupId},</if>
<if test="agenciesId != null">agencies_id = #{agenciesId},</if>
<if test="icWay != null">ic_way = #{icWay},</if>
<if test="iccid != null">iccid = #{iccid},</if>
<if test="volt != null">volt = #{volt},</if>
<if test="pd != null">pd = #{pd},</if>
<if test="sd != null">sd = #{sd},</if>
<if test="imei != null">imei = #{imei},</if>
<if test="gwId != null">gw_id = #{gwId},</if>
<if test="gwName != null">gw_name = #{gwName},</if>
</trim>
where device_id = #{deviceId}
</update>
@@ -852,8 +1018,14 @@
<if test="latitude != null">latitude = #{latitude},</if>
<if test="activeTime != null">active_time = #{activeTime},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="updateTime !=null">update_time = #{updateTime,jdbcType=TIMESTAMP}</if>
<if test="updateTime !=null">update_time = #{updateTime,jdbcType=TIMESTAMP},</if>
<if test="icWay != null">ic_way = #{icWay},</if>
<if test="iccid != null">iccid = #{iccid},</if>
<if test="volt != null">volt = #{volt},</if>
<if test="rssi != null">rssi = #{rssi},</if>
<if test="pd != null">pd = #{pd},</if>
<if test="sd != null">sd = #{sd},</if>
<if test="imei != null">imei = #{imei}</if>
</trim>
where serial_number = #{serialNumber} or gw_dev_code = #{serialNumber}
</update>
@@ -905,6 +1077,14 @@
<if test="slaveId != null">slave_id = #{slaveId},</if>
<if test="groupId != null">group_id = #{groupId},</if>
<if test="agenciesId != null">agencies_id = #{agenciesId},</if>
<if test="icWay != null">ic_way = #{icWay},</if>
<if test="iccid != null">iccid = #{iccid},</if>
<if test="volt != null">volt = #{volt},</if>
<if test="pd != null">pd = #{pd},</if>
<if test="sd != null">sd = #{sd},</if>
<if test="imei != null">imei = #{imei},</if>
<if test="gwId != null">gw_id = #{gwId},</if>
<if test="gwName != null">gw_name = #{gwName},</if>
</trim>
where serial_number = #{serialNumber}
</update>
@@ -1060,7 +1240,7 @@
<select id="listTerminalUser" parameterType="com.xinda.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.firmware_version, d.status,d.rssi,d.is_shadow,d.is_simulate ,d.location_way,
d.firmware_version, d.status,d.rssi,d.is_shadow,d.is_simulate ,d.location_way,d.ic_way,d.iccid,d.volt,d.sd,d.pd,d.imei, d.gw_id, d.gw_name,
d.things_model_value, d.active_time,d.create_time,d.img_url,
(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
@@ -1132,8 +1312,7 @@
<select id="listTerminalUserByGroup" resultType="com.xinda.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.status,d.rssi,d.is_shadow ,d.location_way, d.active_time,d.network_address,d.longitude,d.latitude, d.ic_way,d.iccid,d.voltd.sd,d.pd,d.imei, d.gw_id, d.gw_name,
from (
select device_id, 1 AS is_owner
from iot_device_user