123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525 |
- <?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.zhyc.xps.goaf.mapper.GoafSensorMapper">
- <resultMap id="GoafSensorMapper" type="com.zhyc.xps.goaf.entity.GoafSensor">
- <id column="goaf_sensor_id" property="goafSensorId" jdbcType="BIGINT"/>
- <result column="oc_id" property="ocId" jdbcType="BIGINT"/>
- <result column="goaf_sensor_name" property="goafSensorName" jdbcType="VARCHAR"/>
- <result column="sensor_code" property="sensorCode" jdbcType="BIGINT"/>
- <result column="modbus_id" property="modbusId" jdbcType="BIGINT"/>
- <result column="sensor_baudrate" property="sensorBaudrate" jdbcType="BIGINT"/>
- <result column="goaf_sensor_ip" property="goafSensorIp" jdbcType="VARCHAR"/>
- <result column="goaf_dev_name" property="goafDevName" jdbcType="VARCHAR"/>
- <result column="goaf_dev_typename" property="goafDevTypename" jdbcType="VARCHAR"/>
- <result column="goaf_sensor_location" property="goafSensorLocation" jdbcType="VARCHAR"/>
- <result column="goaf_check_time_interval" property="goafCheckTimeInterval" jdbcType="BIGINT"/>
- <result column="goaf_install_time" property="goafInstallTime" jdbcType="TIMESTAMP"/>
- <result column="goaf_sensor_status" property="goafSensorStatus" jdbcType="BIGINT"/>
- <result column="thv_acc_x" property="thvAccX" jdbcType="BIGINT"/>
- <result column="thv_acc_y" property="thvAccY" jdbcType="BIGINT"/>
- <result column="thv_acc_z" property="thvAccZ" jdbcType="BIGINT"/>
- <result column="thv_vel_x" property="thvVelX" jdbcType="BIGINT"/>
- <result column="thv_vel_y" property="thvVelY" jdbcType="BIGINT"/>
- <result column="thv_vel_z" property="thvVelZ" jdbcType="BIGINT"/>
- <result column="thv_dis_x" property="thvDisX" jdbcType="BIGINT"/>
- <result column="thv_dis_y" property="thvDisY" jdbcType="BIGINT"/>
- <result column="thv_dis_z" property="thvDisZ" jdbcType="BIGINT"/>
- <result column="thv_temperature" property="thvTemperature" jdbcType="BIGINT"/>
- </resultMap>
- <resultMap id="GoafSensorAlarmOverviewMapper" type="com.zhyc.xps.goaf.dto.GoafSensoralarmOverviewDto">
- <result column="goaf_sensor_name" property="goafSensorName" jdbcType="VARCHAR"/>
- <result column="goaf_sensor_location" property="goafSensorLocation" jdbcType="VARCHAR"/>
- <result column="goaf_sensor_status" property="goafSensorStatus" jdbcType="BIGINT"/>
- <result column="goaf_install_time" property="goafInstallTime" jdbcType="TIMESTAMP"/>
- <result column="goaf_sensor_alarm_id" property="goafSensorAlarmId" jdbcType="BIGINT"/>
- <result column="goaf_sensor_alarm_level" property="goafSensorAlarmLevel" jdbcType="BIGINT"/>
- <result column="goaf_sensor_alarm_type" property="goafSensorAlarmType" jdbcType="VARCHAR"/>
- <result column="goaf_datareport_time" property="goafDatareportTime" jdbcType="TIMESTAMP"/>
- </resultMap>
- <!-- <select id="getGoafDevOverview" parameterType="java.util.Map" resultMap="GoafSensorAlarmOverviewMapper">-->
- <!-- SELECT C.goaf_sensor_name, C.goaf_sensor_location, C.goaf_sensor_status, C.goaf_install_time,-->
- <!-- B.goaf_sensor_alarm_id, B.goaf_sensor_alarm_level, B.goaf_sensor_alarm_type, A.goaf_datareport_time-->
- <!-- FROM goaf_sensor AS C-->
- <!-- LEFT JOIN-->
- <!-- (SELECT goaf_sensor_id, goaf_data_id, goaf_datareport_time-->
- <!-- FROM goaf_sensordata-->
- <!-- ORDER BY goaf_datareport_time DESC-->
- <!-- LIMIT 1) AS A ON A.goaf_sensor_id = C.goaf_sensor_id-->
- <!-- LEFT JOIN goaf_sensoralarm AS B ON A.goaf_data_id = B.goaf_data_id-->
- <!-- WHERE C.goaf_sensor_id = #{goafSensorId ,jdbcType=BIGINT}-->
- <!-- </select>-->
- <select id="getGoafDevOverview" parameterType="java.util.Map" resultMap="GoafSensorAlarmOverviewMapper">
- SELECT C.goaf_sensor_name, C.goaf_sensor_location, C.goaf_sensor_status, C.goaf_install_time,
- B.goaf_sensor_alarm_id, B.goaf_sensor_alarm_level, B.goaf_sensor_alarm_type, A.goaf_datareport_time
- FROM goaf_sensor AS C
- LEFT JOIN
- (SELECT goaf_sensor_id, goaf_data_id, goaf_datareport_time
- FROM goaf_sensordata_new
- ) AS A ON A.goaf_sensor_id = C.goaf_sensor_id
- LEFT JOIN goaf_sensoralarm AS B ON A.goaf_data_id = B.goaf_data_id
- WHERE C.goaf_sensor_id = #{goafSensorId ,jdbcType=BIGINT}
- </select>
- <select id="getByList" parameterType="java.util.Map" resultMap="GoafSensorMapper">
- SELECT *
- FROM goaf_sensor
- <trim prefix="where" prefixOverrides="AND">
- <if test="ocId !=null">
- oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="goafSensorName !=null and goafSensorName != ''">
- AND goaf_sensor_name = #{goafSensorName ,jdbcType=VARCHAR}
- </if>
- <if test="goafDevName !=null and goafDevName != ''">
- AND goaf_dev_name = #{goafDevName ,jdbcType=VARCHAR}
- </if>
- <if test="goafSensorStatus !=null and goafSensorStatus != ''">
- AND goaf_sensor_status = #{goafSensorStatus ,jdbcType=BIGINT}
- </if>
- <if test="startDate != null and startDate !='' and endDate != null and endDate != ''">
- AND goaf_install_time BETWEEN #{startDate} AND #{endDate}
- </if>
- </trim>
- </select>
- <!--分页查询-->
- <select id="getByPage" parameterType="java.util.Map" resultMap="GoafSensorMapper">
- SELECT *
- FROM goaf_sensor
- <trim prefix="where" prefixOverrides="AND">
- <if test="ocId !=null">
- oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- <if test="goafSensorName !=null and goafSensorName != ''">
- AND goaf_sensor_name = #{goafSensorName ,jdbcType=VARCHAR}
- </if>
- <if test="goafSensorStatus !=null and goafSensorStatus != ''">
- AND goaf_sensor_status = #{goafSensorStatus ,jdbcType=BIGINT}
- </if>
- <if test="startDate != null and startDate !='' and endDate != null and endDate != ''">
- AND goaf_install_time BETWEEN #{startDate} AND #{endDate}
- </if>
- </trim>
- </select>
- <select id="getByGoafSensorId" resultMap="GoafSensorMapper">
- SELECT *
- FROM goaf_sensor
- WHERE goaf_sensor_id = #{goafSensorId, jdbcType=BIGINT}
- </select>
- <select id="getByGoafSensorIP" resultMap="GoafSensorMapper">
- SELECT *
- FROM goaf_sensor
- WHERE goaf_sensor_ip = #{goafSensorIP, jdbcType=VARCHAR}
- </select>
- <select id="getByGoafsensorCode" resultMap="GoafSensorMapper">
- SELECT *
- FROM goaf_sensor
- WHERE sensor_code = #{sensorCode, jdbcType=BIGINT}
- </select>
- <select id="getByGoafModbusId" resultMap="GoafSensorMapper">
- SELECT *
- FROM goaf_sensor
- WHERE modbus_id = #{modbusId, jdbcType=BIGINT}
- </select>
- <select id="getByGoafSensorName" resultMap="GoafSensorMapper">
- SELECT *
- FROM goaf_sensor
- <if test="ocId !=null">
- oc_id = #{ocId ,jdbcType=BIGINT}
- </if>
- WHERE goaf_sensor_name = #{goafSensorName, jdbcType=VARCHAR}
- </select>
- <insert id="create" parameterType="com.zhyc.xps.goaf.entity.GoafSensor">
- insert into goaf_sensor
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="goafSensorId != null">
- goaf_sensor_id,
- </if>
- <if test="ocId != null">
- oc_id,
- </if>
- <if test="goafSensorName != null and goafSensorName != ''">
- goaf_sensor_name,
- </if>
- <if test="sensorCode != null">
- sensor_code,
- </if>
- <if test="modbusId != null">
- modbus_id,
- </if>
- <if test="sensorBaudrate != null">
- sensor_baudrate,
- </if>
- <if test="goafSensorIp != null and goafSensorIp != ''">
- goaf_sensor_ip,
- </if>
- <if test="goafDevName != null and goafDevName != ''">
- goaf_dev_name,
- </if>
- <if test="goafDevTypename != null and goafDevTypename != ''">
- goaf_dev_typename,
- </if>
- <if test="goafSensorLocation != null and goafSensorLocation != ''">
- goaf_sensor_location,
- </if>
- <if test="goafCheckTimeInterval != null">
- goaf_check_time_interval,
- </if>
- <if test="goafInstallTime != null">
- goaf_install_time,
- </if>
- <if test="goafSensorStatus != null">
- goaf_sensor_status,
- </if>
- <if test="thvAccX != null">
- thv_acc_x,
- </if>
- <if test="thvAccY != null">
- thv_acc_y,
- </if>
- <if test="thvAccZ != null">
- thv_acc_z,
- </if>
- <if test="thvVelX != null">
- thv_vel_x,
- </if>
- <if test="thvVelY != null">
- thv_vel_y,
- </if>
- <if test="thvVelZ != null">
- thv_vel_z,
- </if>
- <if test="thvDisX != null">
- thv_dis_x,
- </if>
- <if test="thvDisY != null">
- thv_dis_y,
- </if>
- <if test="thvDisZ != null">
- thv_dis_z,
- </if>
- <if test="thvTemperature != null">
- thv_temperature,
- </if>
- <if test="ewAccX1 != null">
- ew_acc_x_1,
- </if>
- <if test="ewAccX2 != null">
- ew_acc_x_2,
- </if>
- <if test="ewAccX3 != null">
- ew_acc_x_3,
- </if>
- <if test="ewAccX4 != null">
- ew_acc_x_4,
- </if>
- <if test="ewAccY1 != null">
- ew_acc_y_1,
- </if>
- <if test="ewAccY2 != null">
- ew_acc_y_2,
- </if>
- <if test="ewAccY3 != null">
- ew_acc_y_3,
- </if>
- <if test="ewAccY4 != null">
- ew_acc_y_4,
- </if>
- <if test="ewAccZ1 != null">
- ew_acc_z_1,
- </if>
- <if test="ewAccZ2 != null">
- ew_acc_z_2,
- </if>
- <if test="ewAccZ3 != null">
- ew_acc_z_3,
- </if>
- <if test="ewAccZ4 != null">
- ew_acc_z_4,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="goafSensorId != null">
- #{goafSensorId, jdbcType=BIGINT},
- </if>
- <if test="ocId != null">
- #{ocId, jdbcType=BIGINT},
- </if>
- <if test="goafSensorName != null and goafSensorName != ''">
- #{goafSensorName, jdbcType=VARCHAR},
- </if>
- <if test="sensorCode != null">
- #{sensorCode, jdbcType=BIGINT},
- </if>
- <if test="modbusId != null">
- #{modbusId, jdbcType=BIGINT},
- </if>
- <if test="sensorBaudrate != null">
- #{sensorBaudrate, jdbcType=BIGINT},
- </if>
- <if test="goafSensorIp != null and goafSensorIp != ''">
- #{goafSensorIp, jdbcType=VARCHAR},
- </if>
- <if test="goafDevName != null and goafDevName != ''">
- #{goafDevName, jdbcType=VARCHAR},
- </if>
- <if test="goafDevTypename != null and goafDevTypename != ''">
- #{goafDevTypename, jdbcType=VARCHAR},
- </if>
- <if test="goafSensorLocation != null and goafSensorLocation != ''">
- #{goafSensorLocation, jdbcType=VARCHAR},
- </if>
- <if test="goafCheckTimeInterval != null">
- #{goafCheckTimeInterval, jdbcType=BIGINT},
- </if>
- <if test="goafInstallTime != null">
- #{goafInstallTime, jdbcType=TIMESTAMP},
- </if>
- <if test="goafSensorStatus != null">
- #{goafSensorStatus, jdbcType=BIGINT},
- </if>
- <if test="thvAccX != null">
- #{thvAccX, jdbcType=BIGINT},
- </if>
- <if test="thvAccY != null">
- #{thvAccY, jdbcType=BIGINT},
- </if>
- <if test="thvAccZ != null">
- #{thvAccZ, jdbcType=BIGINT},
- </if>
- <if test="thvVelX != null">
- #{thvVelX, jdbcType=BIGINT},
- </if>
- <if test="thvVelY != null">
- #{thvVelY, jdbcType=BIGINT},
- </if>
- <if test="thvVelZ != null">
- #{thvVelZ, jdbcType=BIGINT},
- </if>
- <if test="thvDisX != null">
- #{thvDisX, jdbcType=BIGINT},
- </if>
- <if test="thvDisY != null">
- #{thvDisY, jdbcType=BIGINT},
- </if>
- <if test="thvDisZ != null">
- #{thvDisZ, jdbcType=BIGINT},
- </if>
- <if test="thvTemperature != null">
- #{thvTemperature, jdbcType=BIGINT},
- </if>
- <if test="ewAccX1 != null">
- #{ewAccX1, jdbcType=BIGINT},
- </if>
- <if test="ewAccX2 != null">
- #{ewAccX2, jdbcType=BIGINT},
- </if>
- <if test="ewAccX3 != null">
- #{ewAccX3, jdbcType=BIGINT},
- </if>
- <if test="ewAccX4 != null">
- #{ewAccX4, jdbcType=BIGINT},
- </if>
- <if test="ewAccY1 != null">
- #{ewAccY1, jdbcType=BIGINT},
- </if>
- <if test="ewAccY2 != null">
- #{ewAccY2, jdbcType=BIGINT},
- </if>
- <if test="ewAccY3 != null">
- #{ewAccY3, jdbcType=BIGINT},
- </if>
- <if test="ewAccY4 != null">
- #{ewAccY4, jdbcType=BIGINT},
- </if>
- <if test="ewAccZ1 != null">
- #{ewAccZ1, jdbcType=BIGINT},
- </if>
- <if test="ewAccZ2 != null">
- #{ewAccZ2, jdbcType=BIGINT},
- </if>
- <if test="ewAccZ3 != null">
- #{ewAccZ3, jdbcType=BIGINT},
- </if>
- <if test="ewAccZ4 != null">
- #{ewAccZ4, jdbcType=BIGINT},
- </if>
- </trim>
- </insert>
- <!--Update更新-->
- <update id="update" parameterType="com.zhyc.xps.goaf.entity.GoafSensor">
- UPDATE goaf_sensor
- <trim suffixOverrides=",">
- <set>
- <if test="goafSensorName != null and goafSensorName != ''">
- goaf_sensor_name = #{goafSensorName, jdbcType=VARCHAR},
- </if>
- <if test="sensorCode != null">
- sensor_code = #{sensorCode, jdbcType=BIGINT},
- </if>
- <if test="modbusId != null">
- modbus_id = #{modbusId, jdbcType=BIGINT},
- </if>
- <if test="sensorBaudrate != null">
- sensor_baudrate = #{sensorBaudrate, jdbcType=BIGINT},
- </if>
- <if test="goafSensorIp != null and goafSensorIp != ''">
- goaf_sensor_ip = #{goafSensorIp, jdbcType=VARCHAR},
- </if>
- <if test="goafDevName != null and goafDevName != ''">
- goaf_dev_name = #{goafDevName, jdbcType=VARCHAR},
- </if>
- <if test="goafDevTypename != null and goafDevTypename != ''">
- goaf_dev_typename = #{goafDevTypename, jdbcType=VARCHAR},
- </if>
- <if test="goafSensorLocation != null and goafSensorLocation != ''">
- goaf_sensor_location = #{goafSensorLocation, jdbcType=VARCHAR},
- </if>
- <if test="goafCheckTimeInterval != null">
- goaf_check_time_interval = #{goafCheckTimeInterval, jdbcType=BIGINT},
- </if>
- <if test="goafInstallTime != null">
- goaf_install_time = #{goafInstallTime, jdbcType=TIMESTAMP},
- </if>
- <if test="goafSensorStatus != null">
- goaf_sensor_status = #{goafSensorStatus, jdbcType=BIGINT},
- </if>
- <if test="thvAccX != null">
- thv_acc_x = #{thvAccX, jdbcType=BIGINT},
- </if>
- <if test="thvAccY != null">
- thv_acc_y = #{thvAccY, jdbcType=BIGINT},
- </if>
- <if test="thvAccZ != null">
- thv_acc_z = #{thvAccZ, jdbcType=BIGINT},
- </if>
- <if test="thvVelX != null">
- thv_vel_x = #{thvVelX, jdbcType=BIGINT},
- </if>
- <if test="thvVelY != null">
- thv_vel_y = #{thvVelY, jdbcType=BIGINT},
- </if>
- <if test="thvVelZ != null">
- thv_vel_z = #{thvVelZ, jdbcType=BIGINT},
- </if>
- <if test="thvDisX != null">
- thv_dis_x = #{thvDisX, jdbcType=BIGINT},
- </if>
- <if test="thvDisY != null">
- thv_dis_y = #{thvDisY, jdbcType=BIGINT},
- </if>
- <if test="thvDisZ != null">
- thv_dis_z = #{thvDisZ, jdbcType=BIGINT},
- </if>
- <if test="thvTemperature != null">
- thv_temperature = #{thvTemperature, jdbcType=BIGINT},
- </if>
- <if test="ewAccX1 != null">
- ew_acc_x_1 = #{ewAccX1, jdbcType=BIGINT},
- </if>
- <if test="ewAccX2 != null">
- ew_acc_x_2 = #{ewAccX2, jdbcType=BIGINT},
- </if>
- <if test="ewAccX3 != null">
- ew_acc_x_3 = #{ewAccX3, jdbcType=BIGINT},
- </if>
- <if test="ewAccX4 != null">
- ew_acc_x_4 = #{ewAccX4, jdbcType=BIGINT},
- </if>
- <if test="ewAccY1 != null">
- ew_acc_y_1 = #{ewAccY1, jdbcType=BIGINT},
- </if>
- <if test="ewAccY2 != null">
- ew_acc_y_2 = #{ewAccY2, jdbcType=BIGINT},
- </if>
- <if test="ewAccY3 != null">
- ew_acc_y_3 = #{ewAccY3, jdbcType=BIGINT},
- </if>
- <if test="ewAccY4 != null">
- ew_acc_y_4 = #{ewAccY4, jdbcType=BIGINT},
- </if>
- <if test="ewAccZ1 != null">
- ew_acc_z_1 = #{ewAccZ1, jdbcType=BIGINT},
- </if>
- <if test="ewAccZ2 != null">
- ew_acc_z_2 = #{ewAccZ2, jdbcType=BIGINT},
- </if>
- <if test="ewAccZ3 != null">
- ew_acc_z_3 = #{ewAccZ3, jdbcType=BIGINT},
- </if>
- <if test="ewAccZ4 != null">
- ew_acc_z_4 = #{ewAccZ4, jdbcType=BIGINT},
- </if>
- </set>
- </trim>
- WHERE goaf_sensor_id = #{goafSensorId, jdbcType=BIGINT}
- </update>
- <delete id="delete" >
- DELETE FROM goaf_sensor
- WHERE goaf_sensor_id = #{goafSensorId, jdbcType=BIGINT}
- </delete>
- <!--列表查询-->
- <select id="getStatisNum" parameterType="java.util.Map" resultType="com.zhyc.xps.goaf.vo.DevStatisVo">
- SELECT
- COUNT(*) AS 'goafSensorTotalNum',
- IFNULL(SUM( CASE WHEN goaf_sensor_status = 1 THEN 1 ELSE 0 END ), 0) AS 'sensorOnlineNum'
- FROM goaf_sensor
- WHERE oc_id = #{ocId ,jdbcType=BIGINT}
- </select>
- </mapper>
|