|
@@ -0,0 +1,568 @@
|
|
|
+<?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.sooka.sponest.monitor.device.mapper.CentermonitorTMonitoringDeviceMapper">
|
|
|
+
|
|
|
+ <resultMap type="CentermonitorTMonitoringDevice" id="CentermonitorTMonitoringDeviceResult">
|
|
|
+ <result property="id" column="id"/>
|
|
|
+ <result property="deviceName" column="device_name"/>
|
|
|
+ <result property="brand" column="brand"/>
|
|
|
+ <result property="deviceCode" column="device_code"/>
|
|
|
+ <result property="longitude" column="longitude"/>
|
|
|
+ <result property="latitude" column="latitude"/>
|
|
|
+ <result property="deptId" column="dept_id"/>
|
|
|
+ <result property="deptName" column="dept_name"/>
|
|
|
+ <result property="workingStatus" column="working_status"/>
|
|
|
+ <result property="deviceType" column="device_type"/>
|
|
|
+ <result property="warnLine" column="warn_line"/>
|
|
|
+ <result property="remark" column="remark"/>
|
|
|
+ <result property="address" column="address"/>
|
|
|
+ <result property="openWarn" column="open_warn"/>
|
|
|
+ <result property="charger" column="charger"/>
|
|
|
+ <result property="chargerTel" column="charger_tel"/>
|
|
|
+ <result property="cameraCode" column="camera_code"/>
|
|
|
+ <result property="cameraName" column="camera_name"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap type="CentermonitorTMonitoringDataWaterQuality" id="CentermonitorTMonitoringDataWaterQualityResult">
|
|
|
+ <result property="id" column="id"/>
|
|
|
+ <result property="deviceCode" column="device_code"/>
|
|
|
+ <result property="waterPh" column="water_ph"/>
|
|
|
+ <result property="waterTemperature" column="water_temperature"/>
|
|
|
+ <result property="waterQualitySuspension" column="water_quality_suspension"/>
|
|
|
+ <result property="waterTemperatureTwo" column="water_temperature_two"/>
|
|
|
+ <result property="conductivity" column="conductivity"/>
|
|
|
+ <result property="ammoniaNitrogen" column="ammonia_nitrogen"/>
|
|
|
+ <result property="cod" column="cod"/>
|
|
|
+ <result property="longitude" column="longitude"/>
|
|
|
+ <result property="latitude" column="latitude"/>
|
|
|
+ <result property="signalStrength" column="signal_strength"/>
|
|
|
+ <result property="errorCode" column="error_code"/>
|
|
|
+ <result property="version" column="version"/>
|
|
|
+ <result property="createTime" column="create_time"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap type="CentermonitorTMonitoringDataSoilMoisture" id="CentermonitorTMonitoringDataSoilMoistureResult">
|
|
|
+ <result property="id" column="id"/>
|
|
|
+ <result property="deviceCode" column="device_code"/>
|
|
|
+ <result property="temperature" column="temperature"/>
|
|
|
+ <result property="humidity" column="humidity"/>
|
|
|
+ <result property="ph" column="ph"/>
|
|
|
+ <result property="conductivity" column="conductivity"/>
|
|
|
+ <result property="nitrogen" column="nitrogen"/>
|
|
|
+ <result property="phosphorus" column="phosphorus"/>
|
|
|
+ <result property="potassium" column="potassium"/>
|
|
|
+ <result property="voltage" column="voltage"/>
|
|
|
+ <result property="createTime" column="create_time"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap type="CentermonitorTMonitoringDataWaterVelocity" id="CentermonitorTMonitoringDataWaterVelocityResult">
|
|
|
+ <result property="id" column="id"/>
|
|
|
+ <result property="ST" column="ST"/>
|
|
|
+ <result property="FUN" column="FUN"/>
|
|
|
+ <result property="TT" column="TT"/>
|
|
|
+ <result property="TYPE" column="TYPE"/>
|
|
|
+ <result property="BAT" column="BAT"/>
|
|
|
+ <result property="Q" column="Q"/>
|
|
|
+ <result property="Q1" column="Q1"/>
|
|
|
+ <result property="CQ1" column="CQ1"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap type="CentermonitorTMonitoringDataAtmosphere" id="CentermonitorTMonitoringDataAtmosphereResult">
|
|
|
+ <result property="id" column="id"/>
|
|
|
+ <result property="deviceCode" column="device_code"/>
|
|
|
+ <result property="fineParticle" column="fine_particle"/>
|
|
|
+ <result property="suctionParticle" column="suction_particle"/>
|
|
|
+ <result property="sulfurDioxide" column="sulfur_dioxide"/>
|
|
|
+ <result property="nitrogenDioxide" column="nitrogen_dioxide"/>
|
|
|
+ <result property="ozone" column="ozone"/>
|
|
|
+ <result property="carbonMonoxide" column="carbon_monoxide"/>
|
|
|
+ <result property="tvoc" column="tvoc"/>
|
|
|
+ <result property="tsp" column="tsp"/>
|
|
|
+ <result property="temperature" column="temperature"/>
|
|
|
+ <result property="humidity" column="humidity"/>
|
|
|
+ <result property="atmos" column="atmos"/>
|
|
|
+ <result property="windSpeed" column="wind_speed"/>
|
|
|
+ <result property="windDirection" column="wind_direction"/>
|
|
|
+ <result property="batteryVoltage" column="battery_voltage"/>
|
|
|
+ <result property="signalStrength" column="signal_strength"/>
|
|
|
+ <result property="errorCode" column="error_code"/>
|
|
|
+ <result property="version" column="version"/>
|
|
|
+ <result property="latitude" column="latitude"/>
|
|
|
+ <result property="longitude" column="longitude"/>
|
|
|
+ <result property="illuminance" column="illuminance"/>
|
|
|
+ <result property="createTime" column="create_time"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap type="CentermonitorTMonitoringDataWaterPressure" id="CentermonitorTMonitoringDataWaterPressureResult">
|
|
|
+ <result property="id" column="id"/>
|
|
|
+ <result property="IMEI" column="IMEI"/>
|
|
|
+ <result property="createTime" column="create_time"/>
|
|
|
+ <result property="thresholdLowEnable" column="threshold_low_enable"/>
|
|
|
+ <result property="thresholdHighEnable" column="threshold_high_enable"/>
|
|
|
+ <result property="signalPower" column="signal_power"/>
|
|
|
+ <result property="hydraulicValue" column="hydraulic_value"/>
|
|
|
+ <result property="hydraulicThresholdMin" column="hydraulic_threshold_min"/>
|
|
|
+ <result property="hydraulicThresholdMax" column="hydraulic_threshold_max"/>
|
|
|
+ <result property="heartbeatTime" column="heartbeat_time"/>
|
|
|
+ <result property="batteryVoltage" column="battery_voltage"/>
|
|
|
+ <result property="batteryValue" column="battery_value"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <resultMap type="CentermonitorTMonitoringDataInsectPests" id="CentermonitorTMonitoringDataInsectPestsResult">
|
|
|
+ <result property="id" column="id"/>
|
|
|
+ <result property="createTime" column="create_time"/>
|
|
|
+ <result property="downloadUrl" column="download_url"/>
|
|
|
+ <result property="downloadUrlCompress" column="download_url_compress"/>
|
|
|
+ <result property="taggingImgUrl" column="tagging_img_url"/>
|
|
|
+ <result property="taggingImgUrlCompress" column="tagging_img_url_compress"/>
|
|
|
+ <result property="deviceNumber" column="device_number"/>
|
|
|
+ <result property="newTime" column="new_time"/>
|
|
|
+ <result property="results" column="results"/>
|
|
|
+ <result property="newCount" column="new_count"/>
|
|
|
+ <result property="typeCount" column="type_count"/>
|
|
|
+ <result property="oldCount" column="old_count"/>
|
|
|
+ <result property="oldTime" column="old_time"/>
|
|
|
+ <result property="oldResults" column="old_results"/>
|
|
|
+ <result property="oldTypeCount" column="old_type_count"/>
|
|
|
+ <result property="oldDownloadUrl" column="old_download_url"/>
|
|
|
+ <result property="oldTaggingImgUrl" column="old_tagging_img_url"/>
|
|
|
+ <result property="oldDownloadUrlCompress" column="old_download_url_compress"/>
|
|
|
+ <result property="oldTaggingImgUrlCompress" column="old_tagging_img_url_compress"/>
|
|
|
+ </resultMap>
|
|
|
+
|
|
|
+ <sql id="selectCentermonitorTMonitoringDeviceVo">
|
|
|
+ SELECT
|
|
|
+ id,
|
|
|
+ device_name,
|
|
|
+ brand,
|
|
|
+ device_code,
|
|
|
+ longitude,
|
|
|
+ latitude,
|
|
|
+ dept_id,
|
|
|
+ dept_name,
|
|
|
+ working_status,
|
|
|
+ device_type,
|
|
|
+ warn_line,
|
|
|
+ remark,
|
|
|
+ address,
|
|
|
+ open_warn,
|
|
|
+ charger,
|
|
|
+ charger_tel
|
|
|
+ FROM
|
|
|
+ centermonitor_t_monitoring_device m
|
|
|
+ </sql>
|
|
|
+
|
|
|
+ <select id="getDevideCodeMapByTypes" resultType="java.util.HashMap">
|
|
|
+ select
|
|
|
+ device_code,
|
|
|
+ device_type
|
|
|
+ from centermonitor_t_monitoring_device
|
|
|
+ where device_type in
|
|
|
+ <foreach collection="array" open="(" separator="," close=")" index="index" item="item">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </select>
|
|
|
+
|
|
|
+
|
|
|
+ <select id="selectAtmosphereAVGData" parameterType="String"
|
|
|
+ resultMap="CentermonitorTMonitoringDataAtmosphereResult">
|
|
|
+ SELECT
|
|
|
+ ROUND(AVG(fine_particle), 2) fine_particle,
|
|
|
+ ROUND(AVG(suction_particle), 2) suction_particle
|
|
|
+ FROM
|
|
|
+ centermonitor_t_monitoring_data_atmosphere
|
|
|
+ WHERE
|
|
|
+ device_code = '${deviceCode}'
|
|
|
+ AND create_time >= '${startTime}'
|
|
|
+ AND create_time <= '${endTime}'
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectInsectPestsNewDeviceData" parameterType="CentermonitorTMonitoringDataInsectPests"
|
|
|
+ resultMap="CentermonitorTMonitoringDataInsectPestsResult">
|
|
|
+ select new_time from centermonitor_t_monitoring_data_insect_pests
|
|
|
+ where device_number = #{deviceNumber} order by new_time desc limit 1
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectSoilMoistureNewDeviceData" parameterType="CentermonitorTMonitoringDataSoilMoisture"
|
|
|
+ resultMap="CentermonitorTMonitoringDataSoilMoistureResult">
|
|
|
+ select create_time from centermonitor_t_monitoring_data_soil_moisture
|
|
|
+ where device_code = #{deviceCode} order by create_time desc limit 1
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectAtmosphereNewDeviceData" parameterType="CentermonitorTMonitoringDataAtmosphere"
|
|
|
+ resultMap="CentermonitorTMonitoringDataAtmosphereResult">
|
|
|
+ select create_time from centermonitor_t_monitoring_data_atmosphere
|
|
|
+ where device_code = #{deviceCode} order by create_time desc limit 1
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectWaterQualityNewDeviceData" parameterType="CentermonitorTMonitoringDataWaterQuality"
|
|
|
+ resultMap="CentermonitorTMonitoringDataWaterQualityResult">
|
|
|
+ select create_time from centermonitor_t_monitoring_data_water_quality
|
|
|
+ where device_code = #{deviceCode} order by create_time desc limit 1
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="selectCentermonitorTMonitoringDeviceByDeviceCode" parameterType="string"
|
|
|
+ resultMap="CentermonitorTMonitoringDeviceResult">
|
|
|
+ <include refid="selectCentermonitorTMonitoringDeviceVo"/>
|
|
|
+ where device_code = #{deviceCode}
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <delete id="deleteAtmosphereDataByCode" parameterType="String">
|
|
|
+ delete from centermonitor_t_monitoring_data_atmosphere where device_code = '${deviceCode}'
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteSoilMoistureDataByCode" parameterType="String">
|
|
|
+ delete from centermonitor_t_monitoring_data_soil_moisture where device_code = '${deviceCode}'
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteWaterQualityDataByCode" parameterType="String">
|
|
|
+ delete from centermonitor_t_monitoring_data_water_quality where device_code = '${deviceCode}'
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteInsectPestsDataByCode" parameterType="String">
|
|
|
+ delete from centermonitor_t_monitoring_data_insect_pests where device_number = '${deviceCode}'
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteWaterPressureDataByCode" parameterType="String">
|
|
|
+ delete from centermonitor_t_monitoring_data_water_pressure where IMEI = '${deviceCode}'
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <delete id="deleteWaterVelocityDataByCode" parameterType="String">
|
|
|
+ delete from centermonitor_t_monitoring_data_water_velocity where ST = '${deviceCode}'
|
|
|
+ </delete>
|
|
|
+
|
|
|
+ <insert id="saveWaterMonitoringData" parameterType="CentermonitorTMonitoringDataWaterVelocity">
|
|
|
+ insert into centermonitor_t_monitoring_data_water_velocity
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">`id`,</if>
|
|
|
+ <if test="ST != null">`ST`,</if>
|
|
|
+ <if test="FUN != null">`FUN`,</if>
|
|
|
+ <if test="TT != null">`TT`,</if>
|
|
|
+ <if test="VER != null">`VER`,</if>
|
|
|
+ <if test="TM != null">`TM`,</if>
|
|
|
+ <if test="MARK != null">`MARK`,</if>
|
|
|
+ <if test="SERIAL != null">`SERIAL`,</if>
|
|
|
+ <if test="TYPE != null">`TYPE`,</if>
|
|
|
+ <if test="DTEMP != null">`DTEMP`,</if>
|
|
|
+ <if test="BAT != null">`BAT`,</if>
|
|
|
+ <if test="SIGNAL != null">`SIGNAL`,</if>
|
|
|
+ <if test="VT != null">`VT`,</if>
|
|
|
+ <if test="Q1 != null">`Q1`,</if>
|
|
|
+ <if test="Q2 != null">`Q2`,</if>
|
|
|
+ <if test="V1 != null">`V1`,</if>
|
|
|
+ <if test="Z1 != null">`Z1`,</if>
|
|
|
+ <if test="Z != null">`Z`,</if>
|
|
|
+ <if test="Q != null">`Q`,</if>
|
|
|
+ <if test="CQ1 != null">`CQ1`,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">#{id},</if>
|
|
|
+ <if test="ST != null">#{ST},</if>
|
|
|
+ <if test="FUN != null">#{FUN},</if>
|
|
|
+ <if test="TT != null">#{TT},</if>
|
|
|
+ <if test="VER != null">#{VER},</if>
|
|
|
+ <if test="TM != null">#{TM},</if>
|
|
|
+ <if test="MARK != null">#{MARK},</if>
|
|
|
+ <if test="SERIAL != null">#{SERIAL},</if>
|
|
|
+ <if test="TYPE != null">#{TYPE},</if>
|
|
|
+ <if test="DTEMP != null">#{DTEMP},</if>
|
|
|
+ <if test="BAT != null">#{BAT},</if>
|
|
|
+ <if test="SIGNAL != null">#{SIGNAL},</if>
|
|
|
+ <if test="VT != null">#{VT},</if>
|
|
|
+ <if test="Q1 != null">#{Q1},</if>
|
|
|
+ <if test="Q2 != null">#{Q2},</if>
|
|
|
+ <if test="V1 != null">#{V1},</if>
|
|
|
+ <if test="Z1 != null">#{Z1},</if>
|
|
|
+ <if test="Z != null">#{Z},</if>
|
|
|
+ <if test="Q != null">#{Q},</if>
|
|
|
+ <if test="CQ1 != null">#{CQ1},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <insert id="saveDataSoilMoistureMonitoringData" parameterType="CentermonitorTMonitoringDataSoilMoisture">
|
|
|
+ insert into centermonitor_t_monitoring_data_soil_moisture
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">`id`,</if>
|
|
|
+ <if test="deviceCode != null">`device_code`,</if>
|
|
|
+ <if test="createTime != null">`create_time`,</if>
|
|
|
+ <if test="temperature != null">`temperature`,</if>
|
|
|
+ <if test="humidity != null">`humidity`,</if>
|
|
|
+ <if test="ph != null">`ph`,</if>
|
|
|
+ <if test="conductivity != null">`conductivity`,</if>
|
|
|
+ <if test="nitrogen != null">`nitrogen`,</if>
|
|
|
+ <if test="phosphorus != null">`phosphorus`,</if>
|
|
|
+ <if test="potassium != null">`potassium`,</if>
|
|
|
+ <if test="latitude != null">`latitude`,</if>
|
|
|
+ <if test="longitude != null">`longitude`,</if>
|
|
|
+ <if test="signalStrength != null">`signal_strength`,</if>
|
|
|
+ <if test="errorCode != null">`error_code`,</if>
|
|
|
+ <if test="version != null">`version`,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">#{id},</if>
|
|
|
+ <if test="deviceCode != null">#{deviceCode},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="temperature != null">#{temperature},</if>
|
|
|
+ <if test="humidity != null">#{humidity},</if>
|
|
|
+ <if test="ph != null">#{ph},</if>
|
|
|
+ <if test="conductivity != null">#{conductivity},</if>
|
|
|
+ <if test="nitrogen != null">#{nitrogen},</if>
|
|
|
+ <if test="phosphorus != null">#{phosphorus},</if>
|
|
|
+ <if test="potassium != null">#{potassium},</if>
|
|
|
+ <if test="latitude != null">#{latitude},</if>
|
|
|
+ <if test="longitude != null">#{longitude},</if>
|
|
|
+ <if test="signalStrength != null">#{signalStrength},</if>
|
|
|
+ <if test="errorCode != null">#{errorCode},</if>
|
|
|
+ <if test="version != null">#{version},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <insert id="saveWaterPressureDeviceData" parameterType="CentermonitorTMonitoringDataWaterPressure">
|
|
|
+ insert into centermonitor_t_monitoring_data_water_pressure
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">`id`,</if>
|
|
|
+ <if test="IMEI != null">`IMEI`,</if>
|
|
|
+ <if test="createTime != null">`create_time`,</if>
|
|
|
+ <if test="thresholdLowEnable != null">`threshold_low_enable`,</if>
|
|
|
+ <if test="thresholdHighEnable != null">`threshold_high_enable`,</if>
|
|
|
+ <if test="signalPower != null">`signal_power`,</if>
|
|
|
+ <if test="hydraulicValue != null">`hydraulic_value`,</if>
|
|
|
+ <if test="hydraulicThresholdMin != null">`hydraulic_threshold_min`,</if>
|
|
|
+ <if test="hydraulicThresholdMax != null">`hydraulic_threshold_max`,</if>
|
|
|
+ <if test="heartbeatTime != null">`heartbeat_time`,</if>
|
|
|
+ <if test="batteryVoltage != null">`battery_voltage`,</if>
|
|
|
+ <if test="batteryValue != null">`battery_value`,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">#{id},</if>
|
|
|
+ <if test="IMEI != null">#{IMEI},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="thresholdLowEnable != null">#{thresholdLowEnable},</if>
|
|
|
+ <if test="thresholdHighEnable != null">#{thresholdHighEnable},</if>
|
|
|
+ <if test="signalPower != null">#{signalPower},</if>
|
|
|
+ <if test="hydraulicValue != null">#{hydraulicValue},</if>
|
|
|
+ <if test="hydraulicThresholdMin != null">#{hydraulicThresholdMin},</if>
|
|
|
+ <if test="hydraulicThresholdMax != null">#{hydraulicThresholdMax},</if>
|
|
|
+ <if test="heartbeatTime != null">#{heartbeatTime},</if>
|
|
|
+ <if test="batteryVoltage != null">#{batteryVoltage},</if>
|
|
|
+ <if test="batteryValue != null">#{batteryValue},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <insert id="saveDataAtmosphereMonitoringData" parameterType="CentermonitorTMonitoringDataAtmosphere">
|
|
|
+ insert into centermonitor_t_monitoring_data_atmosphere
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">`id`,</if>
|
|
|
+ <if test="deviceCode != null">`device_code`,</if>
|
|
|
+ <if test="createTime != null">`create_time`,</if>
|
|
|
+ <if test="fineParticle != null">`fine_particle`,</if>
|
|
|
+ <if test="suctionParticle != null">`suction_particle`,</if>
|
|
|
+ <if test="sulfurDioxide != null">`sulfur_dioxide`,</if>
|
|
|
+ <if test="nitrogenDioxide != null">`nitrogen_dioxide`,</if>
|
|
|
+ <if test="ozone != null">`ozone`,</if>
|
|
|
+ <if test="carbonMonoxide != null">`carbon_monoxide`,</if>
|
|
|
+ <if test="temperature != null">`temperature`,</if>
|
|
|
+ <if test="humidity != null">`humidity`,</if>
|
|
|
+ <if test="atmos != null">`atmos`,</if>
|
|
|
+ <if test="illuminance != null">`illuminance`,</if>
|
|
|
+ <if test="latitude != null">`latitude`,</if>
|
|
|
+ <if test="longitude != null">`longitude`,</if>
|
|
|
+ <if test="signalStrength != null">`signal_strength`,</if>
|
|
|
+ <if test="errorCode != null">`error_code`,</if>
|
|
|
+ <if test="version != null">`version`,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">#{id},</if>
|
|
|
+ <if test="deviceCode != null">#{deviceCode},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="fineParticle != null">#{fineParticle},</if>
|
|
|
+ <if test="suctionParticle != null">#{suctionParticle},</if>
|
|
|
+ <if test="sulfurDioxide != null">#{sulfurDioxide},</if>
|
|
|
+ <if test="nitrogenDioxide != null">#{nitrogenDioxide},</if>
|
|
|
+ <if test="ozone != null">#{ozone},</if>
|
|
|
+ <if test="carbonMonoxide != null">#{carbonMonoxide},</if>
|
|
|
+ <if test="temperature != null">#{temperature},</if>
|
|
|
+ <if test="humidity != null">#{humidity},</if>
|
|
|
+ <if test="atmos != null">#{atmos},</if>
|
|
|
+ <if test="illuminance != null">#{illuminance},</if>
|
|
|
+ <if test="latitude != null">#{latitude},</if>
|
|
|
+ <if test="longitude != null">#{longitude},</if>
|
|
|
+ <if test="signalStrength != null">#{signalStrength},</if>
|
|
|
+ <if test="errorCode != null">#{errorCode},</if>
|
|
|
+ <if test="version != null">#{version},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <insert id="saveDataWaterQualityMonitoringData" parameterType="CentermonitorTMonitoringDataWaterQuality">
|
|
|
+ insert into centermonitor_t_monitoring_data_water_quality
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">`id`,</if>
|
|
|
+ <if test="deviceCode != null">`device_code`,</if>
|
|
|
+ <if test="createTime != null">`create_time`,</if>
|
|
|
+ <if test="waterPh != null">`water_ph`,</if>
|
|
|
+ <if test="waterTemperature != null">`water_temperature`,</if>
|
|
|
+ <if test="waterQualitySuspension != null">`water_quality_suspension`,</if>
|
|
|
+ <if test="waterTemperatureTwo != null">`water_temperature_two`,</if>
|
|
|
+ <if test="conductivity != null">`conductivity`,</if>
|
|
|
+ <if test="ammoniaNitrogen != null">`ammonia_nitrogen`,</if>
|
|
|
+ <if test="cod != null">`cod`,</if>
|
|
|
+ <if test="latitude != null">`latitude`,</if>
|
|
|
+ <if test="longitude != null">`longitude`,</if>
|
|
|
+ <if test="signalStrength != null">`signal_strength`,</if>
|
|
|
+ <if test="errorCode != null">`error_code`,</if>
|
|
|
+ <if test="version != null">`version`,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">#{id},</if>
|
|
|
+ <if test="deviceCode != null">#{deviceCode},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="waterPh != null">#{waterPh},</if>
|
|
|
+ <if test="waterTemperature != null">#{waterTemperature},</if>
|
|
|
+ <if test="waterQualitySuspension != null">#{waterQualitySuspension},</if>
|
|
|
+ <if test="waterTemperatureTwo != null">#{waterTemperatureTwo},</if>
|
|
|
+ <if test="conductivity != null">#{conductivity},</if>
|
|
|
+ <if test="ammoniaNitrogen != null">#{ammoniaNitrogen},</if>
|
|
|
+ <if test="cod != null">#{cod},</if>
|
|
|
+ <if test="latitude != null">#{latitude},</if>
|
|
|
+ <if test="longitude != null">#{longitude},</if>
|
|
|
+ <if test="signalStrength != null">#{signalStrength},</if>
|
|
|
+ <if test="errorCode != null">#{errorCode},</if>
|
|
|
+ <if test="version != null">#{version},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <insert id="saveInsectPestsDeviceData" parameterType="CentermonitorTMonitoringDataInsectPests">
|
|
|
+ insert into centermonitor_t_monitoring_data_insect_pests
|
|
|
+ <trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">`id`,</if>
|
|
|
+ <if test="deviceCode != null">`device_code`,</if>
|
|
|
+ <if test="createTime != null">`create_time`,</if>
|
|
|
+ <if test="downloadUrl != null">`download_url`,</if>
|
|
|
+ <if test="downloadUrlCompress != null">`download_url_compress`,</if>
|
|
|
+ <if test="taggingImgUrl != null">`tagging_img_url`,</if>
|
|
|
+ <if test="taggingImgUrlCompress != null">`tagging_img_url_compress`,</if>
|
|
|
+ <if test="deviceNumber != null">`device_number`,</if>
|
|
|
+ <if test="newTime != null">`new_time`,</if>
|
|
|
+ <if test="results != null">`results`,</if>
|
|
|
+ <if test="newCount != null">`new_count`,</if>
|
|
|
+ <if test="typeCount != null">`type_count`,</if>
|
|
|
+ <if test="oldCount != null">`old_count`,</if>
|
|
|
+ <if test="oldTime != ''">`old_time`,</if>
|
|
|
+ <if test="oldResults != null">`old_results`,</if>
|
|
|
+ <if test="oldTypeCount != null">`old_type_count`,</if>
|
|
|
+ <if test="oldDownloadUrl != null">`old_download_url`,</if>
|
|
|
+ <if test="oldTaggingImgUrl != null">`old_tagging_img_url`,</if>
|
|
|
+ <if test="oldDownloadUrlCompress != null">`old_download_url_compress`,</if>
|
|
|
+ <if test="oldTaggingImgUrlCompress != null">`old_tagging_img_url_compress`,</if>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
+ <if test="id != null">#{id},</if>
|
|
|
+ <if test="deviceCode != null">#{deviceCode},</if>
|
|
|
+ <if test="createTime != null">#{createTime},</if>
|
|
|
+ <if test="downloadUrl != null">#{downloadUrl},</if>
|
|
|
+ <if test="downloadUrlCompress != null">#{downloadUrlCompress},</if>
|
|
|
+ <if test="taggingImgUrl != null">#{taggingImgUrl},</if>
|
|
|
+ <if test="taggingImgUrlCompress != null">#{taggingImgUrlCompress},</if>
|
|
|
+ <if test="deviceNumber != null">#{deviceNumber},</if>
|
|
|
+ <if test="newTime != null">#{newTime},</if>
|
|
|
+ <if test="results != null">#{results},</if>
|
|
|
+ <if test="newCount != null">#{newCount},</if>
|
|
|
+ <if test="typeCount != null">#{typeCount},</if>
|
|
|
+ <if test="oldCount != null">#{oldCount},</if>
|
|
|
+ <if test="oldTime != ''">#{oldTime},</if>
|
|
|
+ <if test="oldResults != null">#{oldResults},</if>
|
|
|
+ <if test="oldTypeCount != null">#{oldTypeCount},</if>
|
|
|
+ <if test="oldDownloadUrl != null">#{oldDownloadUrl},</if>
|
|
|
+ <if test="oldTaggingImgUrl != null">#{oldTaggingImgUrl},</if>
|
|
|
+ <if test="oldDownloadUrlCompress != null">#{oldDownloadUrlCompress},</if>
|
|
|
+ <if test="oldTaggingImgUrlCompress != null">#{oldTaggingImgUrlCompress},</if>
|
|
|
+ </trim>
|
|
|
+ </insert>
|
|
|
+
|
|
|
+ <update id="updateDeviceListToJudgeWorkingStatus" parameterType="CentermonitorTMonitoringDevice">
|
|
|
+ update centermonitor_t_monitoring_device
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="workingStatus != null">working_status = #{workingStatus},</if>
|
|
|
+ </trim>
|
|
|
+ where id = #{id}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <update id="updateDeviceWorkingStatusByDeviceCode" parameterType="CentermonitorTMonitoringDevice">
|
|
|
+ update centermonitor_t_monitoring_device
|
|
|
+ <trim prefix="SET" suffixOverrides=",">
|
|
|
+ <if test="workingStatus != null">working_status = #{workingStatus},</if>
|
|
|
+ </trim>
|
|
|
+ where device_code = #{deviceCode}
|
|
|
+ </update>
|
|
|
+
|
|
|
+ <select id="getDeviceListToJudgeWorkingStatus" resultMap="CentermonitorTMonitoringDeviceResult">
|
|
|
+ <include refid="selectCentermonitorTMonitoringDeviceVo"/>
|
|
|
+ <where>
|
|
|
+ <if test="deviceType != 8 ">and device_type = #{deviceType}</if>
|
|
|
+ </where>
|
|
|
+
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getDeviceData_1_Atmosphere_ListToJudgeWorkingStatus"
|
|
|
+ resultType="CentermonitorTMonitoringDataAtmosphere">
|
|
|
+ SELECT
|
|
|
+ create_time AS createTime
|
|
|
+ FROM
|
|
|
+ centermonitor_t_monitoring_data_atmosphere
|
|
|
+ WHERE
|
|
|
+ device_code = #{deviceCode}
|
|
|
+ order by createTime desc limit 1
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getDeviceData_2_Insect_pests_ListToJudgeWorkingStatus"
|
|
|
+ resultType="CentermonitorTMonitoringDataInsectPests">
|
|
|
+ SELECT
|
|
|
+ create_time AS createTime
|
|
|
+ FROM
|
|
|
+ centermonitor_t_monitoring_data_insect_pests
|
|
|
+ where device_number = #{deviceCode}
|
|
|
+ ORDER BY
|
|
|
+ createTime DESC
|
|
|
+ LIMIT 1
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getDeviceData_3_SoilMoisture_ListToJudgeWorkingStatus"
|
|
|
+ resultType="CentermonitorTMonitoringDataSoilMoisture">
|
|
|
+ SELECT
|
|
|
+ create_time AS createTime
|
|
|
+ FROM
|
|
|
+ centermonitor_t_monitoring_data_soil_moisture
|
|
|
+ WHERE
|
|
|
+ device_code = #{deviceCode}
|
|
|
+ order by createTime desc limit 1
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getDeviceData_4_WaterPressure_ListToJudgeWorkingStatus"
|
|
|
+ resultType="CentermonitorTMonitoringDataWaterPressure">
|
|
|
+ SELECT
|
|
|
+ create_time AS createTime
|
|
|
+ FROM
|
|
|
+ centermonitor_t_monitoring_data_water_pressure
|
|
|
+ WHERE
|
|
|
+ IMEI = #{deviceCode}
|
|
|
+ order by createTime desc limit 1
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getDeviceData_5_WaterQuality_ListToJudgeWorkingStatus"
|
|
|
+ resultType="CentermonitorTMonitoringDataWaterQuality">
|
|
|
+ select create_time as createTime
|
|
|
+ from centermonitor_t_monitoring_data_water_quality
|
|
|
+ where device_code = #{deviceCode}
|
|
|
+ order by createTime desc limit 1
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="getDeviceData_6_WaterVelocity_ListToJudgeWorkingStatus"
|
|
|
+ resultType="CentermonitorTMonitoringDataWaterVelocity">
|
|
|
+ select TT as createTime
|
|
|
+ from centermonitor_t_monitoring_data_water_velocity
|
|
|
+ where ST = #{deviceCode}
|
|
|
+ order by createTime desc limit 1
|
|
|
+ </select>
|
|
|
+</mapper>
|