|
|
|
@ -1,48 +1,65 @@
|
|
|
|
|
<?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">
|
|
|
|
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
|
<mapper namespace="com.ruoyi.system.mapper.BaseSensorInfoMapper">
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<resultMap type="BaseSensorInfo" id="BaseSensorInfoResult">
|
|
|
|
|
<result property="objId" column="ObjId" />
|
|
|
|
|
<result property="edgeId" column="EdgeId" />
|
|
|
|
|
<result property="sensorId" column="Sensor_Id" />
|
|
|
|
|
<result property="sensorName" column="Sensor_Name" />
|
|
|
|
|
<result property="sensorType" column="Sensor_Type" />
|
|
|
|
|
<result property="sensorStatus" column="Sensor_Status" />
|
|
|
|
|
<result property="monitorunitId" column="MonitorUnit_Id" />
|
|
|
|
|
<result property="sensorLocation" column="Sensor_Location" />
|
|
|
|
|
<result property="sensorAddress" column="Sensor_Address" />
|
|
|
|
|
<result property="orderNum" column="Order_Num" />
|
|
|
|
|
<result property="enableFlag" column="Enable_Flag" />
|
|
|
|
|
<result property="createBy" column="Create_By" />
|
|
|
|
|
<result property="createTime" column="Create_Time" />
|
|
|
|
|
<result property="updateBy" column="Update_By" />
|
|
|
|
|
<result property="updateTime" column="Update_Time" />
|
|
|
|
|
<result property="objId" column="ObjId"/>
|
|
|
|
|
<result property="edgeId" column="EdgeId"/>
|
|
|
|
|
<result property="sensorId" column="Sensor_Id"/>
|
|
|
|
|
<result property="sensorName" column="Sensor_Name"/>
|
|
|
|
|
<result property="sensorType" column="Sensor_Type"/>
|
|
|
|
|
<result property="sensorStatus" column="Sensor_Status"/>
|
|
|
|
|
<result property="monitorunitId" column="MonitorUnit_Id"/>
|
|
|
|
|
<result property="sensorLocation" column="Sensor_Location"/>
|
|
|
|
|
<result property="sensorAddress" column="Sensor_Address"/>
|
|
|
|
|
<result property="orderNum" column="Order_Num"/>
|
|
|
|
|
<result property="enableFlag" column="Enable_Flag"/>
|
|
|
|
|
<result property="createBy" column="Create_By"/>
|
|
|
|
|
<result property="createTime" column="Create_Time"/>
|
|
|
|
|
<result property="updateBy" column="Update_By"/>
|
|
|
|
|
<result property="updateTime" column="Update_Time"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<resultMap type="BaseSensorInfoDto" id="BaseSensorInfoDtoResult">
|
|
|
|
|
<result property="objId" column="ObjId" />
|
|
|
|
|
<result property="edgeId" column="EdgeId" />
|
|
|
|
|
<result property="sensorId" column="Sensor_Id" />
|
|
|
|
|
<result property="sensorName" column="Sensor_Name" />
|
|
|
|
|
<result property="sensorType" column="Sensor_Type" />
|
|
|
|
|
<result property="sensorStatus" column="Sensor_Status" />
|
|
|
|
|
<result property="monitorunitId" column="MonitorUnit_Id" />
|
|
|
|
|
<result property="sensorLocation" column="Sensor_Location" />
|
|
|
|
|
<result property="sensorAddress" column="Sensor_Address" />
|
|
|
|
|
<result property="orderNum" column="Order_Num" />
|
|
|
|
|
<result property="enableFlag" column="Enable_Flag" />
|
|
|
|
|
<result property="createBy" column="Create_By" />
|
|
|
|
|
<result property="createTime" column="Create_Time" />
|
|
|
|
|
<result property="updateBy" column="Update_By" />
|
|
|
|
|
<result property="updateTime" column="Update_Time" />
|
|
|
|
|
<result property="monitorunitName" column="MonitorUnit_Name" />
|
|
|
|
|
<result property="objId" column="ObjId"/>
|
|
|
|
|
<result property="edgeId" column="EdgeId"/>
|
|
|
|
|
<result property="sensorId" column="Sensor_Id"/>
|
|
|
|
|
<result property="sensorName" column="Sensor_Name"/>
|
|
|
|
|
<result property="sensorType" column="Sensor_Type"/>
|
|
|
|
|
<result property="sensorStatus" column="Sensor_Status"/>
|
|
|
|
|
<result property="monitorunitId" column="MonitorUnit_Id"/>
|
|
|
|
|
<result property="sensorLocation" column="Sensor_Location"/>
|
|
|
|
|
<result property="sensorAddress" column="Sensor_Address"/>
|
|
|
|
|
<result property="orderNum" column="Order_Num"/>
|
|
|
|
|
<result property="enableFlag" column="Enable_Flag"/>
|
|
|
|
|
<result property="createBy" column="Create_By"/>
|
|
|
|
|
<result property="createTime" column="Create_Time"/>
|
|
|
|
|
<result property="updateBy" column="Update_By"/>
|
|
|
|
|
<result property="updateTime" column="Update_Time"/>
|
|
|
|
|
<result property="monitorunitName" column="MonitorUnit_Name"/>
|
|
|
|
|
<result property="reportParam" column="Param"/>
|
|
|
|
|
<result property="collectTime" column="CollectTime"/>
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectBaseSensorInfoVo">
|
|
|
|
|
select ObjId, EdgeId, Sensor_Id, Sensor_Name, Sensor_Type, Sensor_Status, MonitorUnit_Id, Sensor_Location, Sensor_Address, Order_Num, Enable_Flag, Create_By, Create_Time, Update_By, Update_Time from base_sensor_info
|
|
|
|
|
select ObjId,
|
|
|
|
|
EdgeId,
|
|
|
|
|
Sensor_Id,
|
|
|
|
|
Sensor_Name,
|
|
|
|
|
Sensor_Type,
|
|
|
|
|
Sensor_Status,
|
|
|
|
|
MonitorUnit_Id,
|
|
|
|
|
Sensor_Location,
|
|
|
|
|
Sensor_Address,
|
|
|
|
|
Order_Num,
|
|
|
|
|
Enable_Flag,
|
|
|
|
|
Create_By,
|
|
|
|
|
Create_Time,
|
|
|
|
|
Update_By,
|
|
|
|
|
Update_Time
|
|
|
|
|
from base_sensor_info
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectBaseSensorInfoList" parameterType="BaseSensorInfo" resultMap="BaseSensorInfoDtoResult">
|
|
|
|
@ -64,20 +81,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
t1.Update_Time
|
|
|
|
|
from base_sensor_info t1
|
|
|
|
|
left join base_monitorunit_info t2 on t1.MonitorUnit_Id = t2.MonitorUnit_Id
|
|
|
|
|
<where>
|
|
|
|
|
<if test="EdgeId != null and EdgeId != ''"> and t1.EdgeId = #{EdgeId}</if>
|
|
|
|
|
<if test="sensorId != null and sensorId != ''"> and t1.Sensor_Id = #{sensorId}</if>
|
|
|
|
|
<if test="sensorName != null and sensorName != ''"> and t1.Sensor_Name like concat('%', #{sensorName}, '%')</if>
|
|
|
|
|
<if test="sensorType != null and sensorType != ''"> and t1.Sensor_Type = #{sensorType}</if>
|
|
|
|
|
<if test="sensorStatus != null "> and t1.Sensor_Status = #{sensorStatus}</if>
|
|
|
|
|
<if test="monitorunitId != null and monitorunitId != ''"> and t1.MonitorUnit_Id = #{monitorunitId}</if>
|
|
|
|
|
<if test="sensorLocation != null and sensorLocation != ''"> and t1.Sensor_Location = #{sensorLocation}</if>
|
|
|
|
|
<if test="sensorAddress != null and sensorAddress != ''"> and t1.Sensor_Address = #{sensorAddress}</if>
|
|
|
|
|
<if test="orderNum != null "> and t1.Order_Num = #{orderNum}</if>
|
|
|
|
|
<if test="enableFlag != null "> and t1.Enable_Flag = #{enableFlag}</if>
|
|
|
|
|
<where>
|
|
|
|
|
<if test="EdgeId != null and EdgeId != ''">and t1.EdgeId = #{EdgeId}</if>
|
|
|
|
|
<if test="sensorId != null and sensorId != ''">and t1.Sensor_Id = #{sensorId}</if>
|
|
|
|
|
<if test="sensorName != null and sensorName != ''">and t1.Sensor_Name like concat('%', #{sensorName},
|
|
|
|
|
'%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="sensorType != null and sensorType != ''">and t1.Sensor_Type = #{sensorType}</if>
|
|
|
|
|
<if test="sensorStatus != null ">and t1.Sensor_Status = #{sensorStatus}</if>
|
|
|
|
|
<if test="monitorunitId != null and monitorunitId != ''">and t1.MonitorUnit_Id = #{monitorunitId}</if>
|
|
|
|
|
<if test="sensorLocation != null and sensorLocation != ''">and t1.Sensor_Location = #{sensorLocation}</if>
|
|
|
|
|
<if test="sensorAddress != null and sensorAddress != ''">and t1.Sensor_Address = #{sensorAddress}</if>
|
|
|
|
|
<if test="orderNum != null ">and t1.Order_Num = #{orderNum}</if>
|
|
|
|
|
<if test="enableFlag != null ">and t1.Enable_Flag = #{enableFlag}</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="selectBaseSensorInfoByObjId" parameterType="Long" resultMap="BaseSensorInfoDtoResult">
|
|
|
|
|
select t1.ObjId,
|
|
|
|
|
t1.EdgeId,
|
|
|
|
@ -99,7 +118,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
left join base_monitorunit_info t2 on t1.MonitorUnit_Id = t2.MonitorUnit_Id
|
|
|
|
|
where t1.ObjId = #{objId}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<select id="selectSensorDataListBySensorType" parameterType="String" resultMap="BaseSensorInfoDtoResult">
|
|
|
|
|
select t1.EdgeId, t1.Sensor_Id, t1.Sensor_Type, t1.Sensor_Name, t2.Param, t2.CollectTime,t1.Sensor_Location
|
|
|
|
|
from base_sensor_info t1
|
|
|
|
|
left join record_upload t2 on t2.Sensor_Id = t1.Sensor_Id
|
|
|
|
|
where t1.Sensor_Type = #{sensorType}
|
|
|
|
|
and t2.Type = 'CMD_REPORTDATA'
|
|
|
|
|
and t2.Param is not null
|
|
|
|
|
and t2.CollectTime between DATE_FORMAT(now(), '%Y-%m-%d 00:00:00') and DATE_FORMAT(now(), '%Y-%m-%d 23:59:59');
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertBaseSensorInfo" parameterType="BaseSensorInfo" useGeneratedKeys="true" keyProperty="objId">
|
|
|
|
|
insert into base_sensor_info
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
@ -117,7 +146,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
<if test="createTime != null">Create_Time,</if>
|
|
|
|
|
<if test="updateBy != null">Update_By,</if>
|
|
|
|
|
<if test="updateTime != null">Update_Time,</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="EdgeId != null">#{EdgeId},</if>
|
|
|
|
|
<if test="sensorId != null">#{sensorId},</if>
|
|
|
|
@ -133,7 +162,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="updateBaseSensorInfo" parameterType="BaseSensorInfo">
|
|
|
|
@ -158,11 +187,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteBaseSensorInfoByObjId" parameterType="Long">
|
|
|
|
|
delete from base_sensor_info where ObjId = #{objId}
|
|
|
|
|
delete
|
|
|
|
|
from base_sensor_info
|
|
|
|
|
where ObjId = #{objId}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteBaseSensorInfoByObjIds" parameterType="String">
|
|
|
|
|
delete from base_sensor_info where ObjId in
|
|
|
|
|
delete from base_sensor_info where ObjId in
|
|
|
|
|
<foreach item="objId" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{objId}
|
|
|
|
|
</foreach>
|
|
|
|
|