123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216 |
- <?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.GoafSensoralarmMapper">
- <resultMap id="GoafSensoralarmMapper" type="com.zhyc.xps.goaf.entity.GoafSensoralarm">
- <id column="goaf_sensor_alarm_id" property="goafSensorAlarmId" jdbcType="BIGINT"/>
- <result column="goaf_data_id" property="goafDataId" jdbcType="BIGINT"/>
- <result column="goaf_sensor_alarm_level" property="goafSensorAlarmLevel" jdbcType="BIGINT"/>
- <result column="goaf_sensor_alarm_type" property="goafSensorAlarmType" jdbcType="VARCHAR"/>
- </resultMap>
- <resultMap id="GoafSensoralarmDtoMapper" type="com.zhyc.xps.goaf.dto.GoafSensoralarmDto">
- <id column="goaf_sensor_alarm_id" property="goafSensorAlarmId" jdbcType="BIGINT"/>
- <result column="oc_id" property="ocId" jdbcType="BIGINT"/>
- <result column="goaf_data_id" property="goafDataId" 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_sensor_id" property="goafSensorId" jdbcType="BIGINT"/>
- <result column="goaf_sensor_name" property="goafSensorName" jdbcType="VARCHAR"/>
- <result column="goaf_dev_name" property="goafDevName" jdbcType="VARCHAR"/>
- <result column="goaf_dev_typename" property="goafDevTypename" jdbcType="VARCHAR"/>
- <result column="frequency_x" property="frequencyX" jdbcType="BIGINT"/>
- <result column="frequency_y" property="frequencyY" jdbcType="BIGINT"/>
- <result column="frequency_z" property="frequencyZ" jdbcType="BIGINT"/>
- <result column="acc_x" property="accX" jdbcType="BIGINT"/>
- <result column="acc_y" property="accY" jdbcType="BIGINT"/>
- <result column="acc_z" property="accZ" jdbcType="BIGINT"/>
- <result column="vel_x" property="velX" jdbcType="BIGINT"/>
- <result column="vel_y" property="velY" jdbcType="BIGINT"/>
- <result column="vel_z" property="velZ" jdbcType="BIGINT"/>
- <result column="dis_x" property="disX" jdbcType="BIGINT"/>
- <result column="dis_y" property="disY" jdbcType="BIGINT"/>
- <result column="dis_z" property="disZ" jdbcType="BIGINT"/>
- <result column="sensor_temperature" property="sensorTemperature" jdbcType="BIGINT"/>
- <result column="ang_x" property="angX" jdbcType="BIGINT"/>
- <result column="ang_y" property="angY" jdbcType="BIGINT"/>
- <result column="ang_z" property="angZ" jdbcType="BIGINT"/>
- <result column="goaf_datareport_time" property="goafDatareportTime" jdbcType="TIMESTAMP"/>
- </resultMap>
- <select id="getByList" parameterType="java.util.Map" resultMap="GoafSensoralarmDtoMapper">
- SELECT A.*,
- B.oc_id,
- B.goaf_sensor_id,
- B.goaf_sensor_name,
- B.goaf_dev_name,
- B.goaf_dev_typename,
- B.frequency_x,
- B.frequency_y,
- B.frequency_z,
- B.acc_x,
- B.acc_y,
- B.acc_z,
- B.vel_x,
- B.vel_y,
- B.vel_z,
- B.dis_x,
- B.dis_y,
- B.dis_z,
- B.sensor_temperature,
- B.ang_x,
- B.ang_y,
- B.ang_z,
- B.f_alarm_temperature,
- B.goaf_datareport_time
- FROM goaf_sensoralarm AS A
- LEFT JOIN goaf_sensordata AS B ON A.goaf_data_id = B.goaf_data_id
- WHERE B.oc_id = #{ocId ,jdbcType=BIGINT}
- <if test="goafSensorAlarmLevel !=null">
- AND A.goaf_sensor_alarm_level = #{goafSensorAlarmLevel ,jdbcType=BIGINT}
- </if>
- <if test="goafSensorAlarmType !=null and goafSensorAlarmType != ''">
- AND A.goaf_sensor_alarm_type = like concat('%',#{goafSensorAlarmType ,jdbcType=VARCHAR}, '%')
- </if>
- <if test="goafSensorName !=null and goafSensorName != ''">
- AND B.goaf_sensor_name = #{goafSensorName ,jdbcType=VARCHAR}
- </if>
- <if test="goafDevName !=null and goafDevName != ''">
- AND B.goaf_dev_name = #{goafDevName ,jdbcType=VARCHAR}
- </if>
- <if test="goafDevTypename !=null and goafDevTypename != ''">
- AND B.goaf_dev_typename = #{goafDevTypename ,jdbcType=VARCHAR}
- </if>
- <if test="startDate != null and endDate != null">
- AND B.goaf_datareport_time BETWEEN #{startDate} AND #{endDate}
- </if>
- ORDER BY B.goaf_datareport_time DESC
- </select>
- <!--分页查询-->
- <select id="getByPage" parameterType="java.util.Map" resultMap="GoafSensoralarmDtoMapper">
- SELECT A.*,
- B.oc_id,
- B.goaf_sensor_id,
- B.goaf_sensor_name,
- B.goaf_dev_name,
- B.goaf_dev_typename,
- B.frequency_x,
- B.frequency_y,
- B.frequency_z,
- B.acc_x,
- B.acc_y,
- B.acc_z,
- B.vel_x,
- B.vel_y,
- B.vel_z,
- B.dis_x,
- B.dis_y,
- B.dis_z,
- B.sensor_temperature,
- B.ang_x,
- B.ang_y,
- B.ang_z,
- B.f_alarm_temperature,
- B.goaf_datareport_time
- FROM goaf_sensoralarm AS A
- LEFT JOIN goaf_sensordata AS B ON A.goaf_data_id = B.goaf_data_id
- WHERE B.oc_id = #{ocId ,jdbcType=BIGINT}
- <if test="goafSensorAlarmLevel !=null">
- AND A.goaf_sensor_alarm_level = #{goafSensorAlarmLevel ,jdbcType=BIGINT}
- </if>
- <if test="goafSensorAlarmType !=null and goafSensorAlarmType != ''">
- AND A.goaf_sensor_alarm_type = #{goafSensorAlarmType ,jdbcType=VARCHAR}
- </if>
- <if test="goafSensorName !=null and goafSensorName != ''">
- AND B.goaf_sensor_name = #{goafSensorName ,jdbcType=VARCHAR}
- </if>
- <if test="goafDevName !=null and goafDevName != ''">
- AND B.goaf_dev_name = #{goafDevName ,jdbcType=VARCHAR}
- </if>
- <if test="goafDevTypename !=null and goafDevTypename != ''">
- AND B.goaf_dev_typename = #{goafDevTypename ,jdbcType=VARCHAR}
- </if>
- <if test="startDate != null and startDate !='' and endDate != null and endDate != ''">
- AND B.goaf_datareport_time BETWEEN #{startDate} AND #{endDate}
- </if>
- ORDER BY B.goaf_datareport_time DESC
- </select>
- <!--传感器告警个数查询(按类别)-->
- <select id="getSensorAlarmNum" parameterType="java.util.Map" resultType="com.zhyc.xps.goaf.vo.SensorAlarmNumVo">
- SELECT SUM(CASE WHEN salarm.goaf_sensor_alarm_level = 0 THEN 1 ELSE 0 END) AS sensorGenAlarmNum,
- SUM(CASE WHEN salarm.goaf_sensor_alarm_level = 1 THEN 1 ELSE 0 END) AS sensorCriAlarmNum
- FROM goaf_sensoralarm AS salarm
- LEFT JOIN goaf_sensordata AS senn ON senn.goaf_data_id = salarm.goaf_data_id
- WHERE senn.oc_id = #{ocId ,jdbcType=BIGINT}
- <if test="startDate != null and startDate !='' and endDate != null and endDate != ''">
- AND senn.goaf_datareport_time BETWEEN #{startDate} and #{endDate}
- </if>
- </select>
- <!--传感器数据个数查询-->
- <select id="getsensorNormalNum" parameterType="java.util.Map" resultType="java.lang.Long">
- SELECT count(*) as sensorNormalNum
- FROM goaf_sensordata
- WHERE oc_id = #{ocId ,jdbcType=BIGINT}
- <if test="startDate != null and startDate !='' and endDate != null and endDate != ''">
- AND goaf_datareport_time BETWEEN #{startDate} and #{endDate}
- </if>
- </select>
- <insert id="create" parameterType="com.zhyc.xps.goaf.entity.GoafSensoralarm">
- insert into goaf_sensoralarm
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="goafSensorAlarmId != null">
- goaf_sensor_alarm_id,
- </if>
- <if test="goafDataId != null">
- goaf_data_id,
- </if>
- <if test="goafSensorAlarmLevel != null">
- goaf_sensor_alarm_level,
- </if>
- <if test="goafSensorAlarmType != null and goafSensorAlarmType != ''">
- goaf_sensor_alarm_type,
- </if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="goafSensorAlarmId != null">
- #{goafSensorAlarmId, jdbcType=BIGINT},
- </if>
- <if test="goafDataId != null">
- #{goafDataId, jdbcType=BIGINT},
- </if>
- <if test="goafSensorAlarmLevel != null">
- #{goafSensorAlarmLevel, jdbcType=BIGINT},
- </if>
- <if test="goafSensorAlarmType != null and goafSensorAlarmType != ''">
- #{goafSensorAlarmType, jdbcType=VARCHAR},
- </if>
- </trim>
- </insert>
- </mapper>
|