提交增加运维管理

This commit is contained in:
LEED
2025-04-29 22:30:18 +08:00
parent 4201690d93
commit 360b630306
98 changed files with 6300 additions and 45 deletions

View File

@@ -447,7 +447,7 @@
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,
p.protocol_code,p.transport,d.guid,
d.group_id,d.agencies_id
from iot_device d
left join iot_product p on p.product_id=d.product_id
@@ -547,7 +547,7 @@
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
p.protocol_code,p.transport,d.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>
@@ -585,7 +585,7 @@
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
p.protocol_code,p.transport,d.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>
@@ -624,7 +624,7 @@
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
p.protocol_code,p.transport,d.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>
@@ -658,7 +658,7 @@
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
p.protocol_code,p.transport,d.guid
from iot_device d
left join iot_product p on p.product_id=d.product_id
<where>
@@ -697,7 +697,7 @@
d.img_url,
d.summary,
d.remark,
p.guid,
d.guid,
d.group_id,
d.agencies_id,
d.ic_way,
@@ -891,6 +891,8 @@
<if test="imei != null">imei,</if>
<if test="gwId != null">gw_id,</if>
<if test="gwName != null">gw_name,</if>
<if test="guid != null">guid,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deviceName != null and deviceName != ''">#{deviceName},</if>
@@ -931,13 +933,14 @@
<if test="imei != null">#{imei},</if>
<if test="gwId != null">#{gwId},</if>
<if test="gwName != null">#{gwName},</if>
<if test="guid != null">#{guid},</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,ic_way,iccid,volt,sd,pd,imei, gw_id, gw_name)
firmware_version, rssi, is_shadow, location_way, create_by, create_time,ic_way,iccid,volt,sd,pd,imei, gw_id, gw_name,guid)
values
<foreach collection="deviceList" item="device" separator=",">
(#{device.deviceName},
@@ -959,7 +962,8 @@
#{device.pd}),
#{device.imei}),
#{device.gwId}),
#{device.geName})
#{device.geName}),
#{device.guid})
</foreach>
</insert>
@@ -1004,6 +1008,7 @@
<if test="imei != null">imei = #{imei},</if>
<if test="gwId != null">gw_id = #{gwId},</if>
<if test="gwName != null">gw_name = #{gwName},</if>
<if test="guid != null">guid = #{guid},</if>
</trim>
where device_id = #{deviceId}
</update>
@@ -1085,6 +1090,7 @@
<if test="imei != null">imei = #{imei},</if>
<if test="gwId != null">gw_id = #{gwId},</if>
<if test="gwName != null">gw_name = #{gwName},</if>
<if test="guid != null">guid = #{guid},</if>
</trim>
where serial_number = #{serialNumber}
</update>
@@ -1408,5 +1414,17 @@
where status = 4
and group_id = '0'
</update>
<select id="selectScadaIdByGuid" resultType="Long">
select id
from scada
where guid = #{guid}
</select>
<select id="selectListScadaIdByGuidS" resultType="com.xinda.iot.model.DeviceShortOutput">
select id scadaId, guid
from scada
where guid in
<foreach collection="guidList" item="guid" open="(" separator="," close=")">
#{guid}
</foreach>
</select>
</mapper>

View File

@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xinda.iot.mapper.PipMapper">
<resultMap type="Pip" id="PipResult">
<result property="deptId" column="dept_id" />
<result property="pipJson" column="pip_json" />
</resultMap>
<sql id="selectPipVo">
select p.dept_id, p.pip_json from iot_pip p
</sql>
<select id="selectPipList" parameterType="Pip" resultMap="PipResult">
<include refid="selectPipVo"/>
<where>
<if test="deptId != null and deptId != 0 ">
and
( d.dept_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="pipJson != null and pipJson != ''"> and p.pip_json = #{pipJson}</if>
</where>
</select>
<select id="selectPipByDeptId" parameterType="Long" resultMap="PipResult">
<include refid="selectPipVo"/>
where p.dept_id = #{deptId}
</select>
<insert id="insertPip" parameterType="Pip">
insert into iot_pip
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="deptId != null">dept_id,</if>
<if test="pipJson != null">pip_json,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deptId != null">#{deptId},</if>
<if test="pipJson != null">#{pipJson},</if>
</trim>
</insert>
<update id="updatePip" parameterType="Pip">
update iot_pip
<trim prefix="SET" suffixOverrides=",">
<if test="pipJson != null">pip_json = #{pipJson},</if>
</trim>
where dept_id = #{deptId}
</update>
<delete id="deletePipByDeptId" parameterType="Long">
delete from iot_pip where dept_id = #{deptId}
</delete>
<delete id="deletePipByDeptIds" parameterType="String">
delete from iot_pip where dept_id in
<foreach item="deptId" collection="array" open="(" separator="," close=")">
#{deptId}
</foreach>
</delete>
</mapper>