123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- <?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.bizmatics.persistence.mapper.HtAnalogDataMapper">
- <select id="selectByEndTime" resultType="com.bizmatics.model.HtAnalogData">
- select had.id,deviceName,Busot,COS,COSa,COSb,COSc,Demand,DevResetTimes,DeviceTemp,Epn,Epn1,Epn2,Epn3,Epn4,Epp,
- Epp1,Epp2,Epp3,Epp4,Eqn,Eqp,F,I0,I2,IHa,IHb,IHc,Ia,Ib,Ic,Ir,LastDayMD,LastDayMDt,P,Pa,Pb,Pc,Q,Qa,Qb,Qc,SignalIntensity,
- T1,T2,T3,T4,THDUa,THDUb,THDUc,Ua,Uab,Ub,Ubc,UblU0,UblU2,Uc,Uca,Udt,Ul,Upt,Ust,freezingTime,dataTime
- from user_site as us
- inner join device as d
- on us.site_id = d.site_id
- inner join ht_analog_data as had
- on d.device_code = had.deviceName
- <where>
- <if test="userId != null and userId != 0">
- and us.user_id = #{userId}
- </if>
- <if test="siteId != null and siteId != 0">
- and us.site_id = #{siteId}
- </if>
- <if test="endTime != null and startTime != null">
- and dataTime BETWEEN #{startTime} and #{endTime}
- </if>
- </where>
- order by had.id desc limit 0,1
- </select>
- <select id="selectByStartTime" resultType="com.bizmatics.model.HtAnalogData">
- select had.id,deviceName,Busot,COS,COSa,COSb,COSc,Demand,DevResetTimes,DeviceTemp,Epn,Epn1,Epn2,Epn3,Epn4,Epp,
- Epp1,Epp2,Epp3,Epp4,Eqn,Eqp,F,I0,I2,IHa,IHb,IHc,Ia,Ib,Ic,Ir,LastDayMD,LastDayMDt,P,Pa,Pb,Pc,Q,Qa,Qb,Qc,SignalIntensity,
- T1,T2,T3,T4,THDUa,THDUb,THDUc,Ua,Uab,Ub,Ubc,UblU0,UblU2,Uc,Uca,Udt,Ul,Upt,Ust,freezingTime,dataTime
- from user_site as us
- inner join device as d
- on us.site_id = d.site_id
- inner join ht_analog_data as had
- on d.device_code = had.deviceName
- <where>
- <if test="userId != null and userId != 0">
- and us.user_id = #{userId}
- </if>
- <if test="siteId != null and siteId != 0">
- and us.site_id = #{siteId}
- </if>
- <if test="endTime != null and startTime != null">
- and dataTime BETWEEN #{startTime} and #{endTime}
- </if>
- </where>
- order by had.id asc limit 0,1
- </select>
- <select id="selectMaxAndMinAndAvg" resultType="java.util.Map">
- select max(Demand) as demandMax,min(Demand) as demandMin,avg(Demand) as demandAvg,
- max(Epp) as eppMax,min(Epp) as eppMin,avg(Epp) as eppAvg
- from device as d
- inner join ht_analog_data as had
- on d.device_code = had.deviceName
- <where>
- <if test="siteId != null and siteId != 0">
- and d.site_id = #{siteId}
- </if>
- <if test="endTime != null and startTime != null">
- and dataTime BETWEEN #{startTime} and #{endTime}
- </if>
- </where>
- </select>
- <select id="list" resultType="com.bizmatics.model.HtAnalogData">
- select max(Epp),min(Epp)
- from
- ht_analog_data
- <where>
- <if test="deviceCode != null and deviceCode != ''">
- and deviceName = #{deviceCode}
- </if>
- <if test="endTime != null and startTime != null">
- and dataTime BETWEEN #{startTime} and #{endTime}
- </if>
- </where>
- </select>
- <select id="page" resultType="com.bizmatics.model.HtAnalogData">
- select
- had.id,deviceName,Busot,COS,COSa,COSb,COSc,Demand,DevResetTimes,DeviceTemp,Epn,Epn1,Epn2,Epn3,Epn4,Epp,
- Epp1,Epp2,Epp3,Epp4,Eqn,Eqp,F,I0,I2,IHa,IHb,IHc,Ia,Ib,Ic,Ir,LastDayMD,LastDayMDt,P,Pa,Pb,Pc,Q,Qa,Qb,Qc,SignalIntensity,
- T1,T2,T3,T4,THDUa,THDUb,THDUc,Ua,Uab,Ub,Ubc,UblU0,UblU2,Uc,Uca,Udt,Ul,Upt,Ust,freezingTime,dataTime,d.site_id as siteId
- from ht_analog_data as had
- left join device as d
- on had.deviceName = d.device_code
- <where>
- <if test="endTime != null and startTime != null">
- and dataTime BETWEEN #{startTime} and #{endTime}
- </if>
- </where>
- order by had.id asc
- limit #{current},#{size}
- </select>
- <select id="getDateList" resultType="java.util.Map">
- select d.site_id as siteId,date(had.dataTime) as dat
- FROM
- ht_analog_data as had
- INNER JOIN device as d
- on had.deviceName = d.device_code
- <where>
- <if test="endTime != null and startTime != null">
- and had.dataTime BETWEEN #{startTime} and #{endTime}
- </if>
- </where>
- GROUP BY d.site_id,dat
- </select>
- <select id="selectCount" resultType="java.lang.Double">
- select
- IFNULL(sum(had.epp),0)
- from device as d
- inner join ht_analog_data as had
- on d.device_code = had.deviceName
- <where>
- <if test="siteId != null and siteId != 0">
- and d.site_id = #{siteId}
- </if>
- <if test="endTime != null and startTime != null">
- and dataTime BETWEEN #{startTime} and #{endTime}
- </if>
- </where>
- </select>
- <select id="yearOnYearOne" resultType="com.bizmatics.model.vo.HtAnalogDataVo">
- select
- id,deviceName,AVG(Busot) AS Busot,AVG(COS) as COS,AVG(COSa) as COSa,AVG(COSb) as COSb,AVG(COSc) as COSc,AVG(Demand) as Demand,AVG(DevResetTimes) as DevResetTimes,AVG(DeviceTemp) as DeviceTemp,
- AVG(Epn) as Epn,AVG(Epn1) as Epn1,AVG(Epn2) as Epn2,AVG(Epn3) as Epn3,AVG(Epn4) as Epn4,AVG(Epp) as Epp,AVG(Epp1) as Epp1,AVG(Epp2) as Epp2,AVG(Epp3) as Epp3,AVG(Epp4) as Epp4,AVG(Eqn) as Eqn,
- AVG(Eqp) as Eqp,AVG(F) as F,AVG(I0) as I0,AVG(I2) as I2,AVG(IHa) as IHa,AVG(IHb) as IHb,AVG(IHc) as IHc,AVG(Ia) as Ia,AVG(Ib) as Ib,AVG(Ic) as Ic,AVG(Ir) as Ir,AVG(LastDayMD) as LastDayMD,
- AVG(LastDayMDt) as LastDayMDt,AVG(P) as P,AVG(Pa) as Pa,AVG(Pb) as Pb,AVG(Pc) as Pc,AVG(Q) as Q,AVG(Qa) as Qa,AVG(Qb) as Qb,AVG(Qc) as Qc,AVG(SignalIntensity) as SignalIntensity,AVG(T1) as T1,
- AVG(T2) as T2,AVG(T3) as T3,AVG(T4) as T4,AVG(THDUa) as THDUa,AVG(THDUb) as THDUb,AVG(THDUc) as THDUc,AVG(Ua) as Ua,AVG(Uab) as Uab,AVG(Ub) as Ub,AVG(Ubc) as Ubc,AVG(UblU0) as UblU0,AVG(UblU2) as UblU2,
- AVG(Uc) as Uc,AVG(Uca) as Uca,AVG(Udt) as Udt,AVG(Ul) as Ul,AVG(Upt) as Upt,AVG(Ust) as Ust,FROM_UNIXTIME(UNIX_TIMESTAMP(dataTime) , '%m-%d %H:%i') as freezingTimes,dataTime
- from ht_analog_data
- <where>
- and deviceName = #{deviceCode}
- <if test="endTime != null and startTime != null and endTime != '' and startTime != ''">
- and dataTime BETWEEN #{startTime} and #{endTime}
- </if>
- </where>
- <if test="type != 0">
- GROUP BY freezingTime
- </if>
- </select>
- <select id="yearOnYearTwo" resultType="com.bizmatics.model.vo.HtAnalogDataVo">
- select
- id,deviceName,AVG(Busot) AS Busot,AVG(COS) as COS,AVG(COSa) as COSa,AVG(COSb) as COSb,AVG(COSc) as COSc,AVG(Demand) as Demand,AVG(DevResetTimes) as DevResetTimes,AVG(DeviceTemp) as DeviceTemp,
- AVG(Epn) as Epn,AVG(Epn1) as Epn1,AVG(Epn2) as Epn2,AVG(Epn3) as Epn3,AVG(Epn4) as Epn4,AVG(Epp) as Epp,AVG(Epp1) as Epp1,AVG(Epp2) as Epp2,AVG(Epp3) as Epp3,AVG(Epp4) as Epp4,AVG(Eqn) as Eqn,
- AVG(Eqp) as Eqp,AVG(F) as F,AVG(I0) as I0,AVG(I2) as I2,AVG(IHa) as IHa,AVG(IHb) as IHb,AVG(IHc) as IHc,AVG(Ia) as Ia,AVG(Ib) as Ib,AVG(Ic) as Ic,AVG(Ir) as Ir,AVG(LastDayMD) as LastDayMD,
- AVG(LastDayMDt) as LastDayMDt,AVG(P) as P,AVG(Pa) as Pa,AVG(Pb) as Pb,AVG(Pc) as Pc,AVG(Q) as Q,AVG(Qa) as Qa,AVG(Qb) as Qb,AVG(Qc) as Qc,AVG(SignalIntensity) as SignalIntensity,AVG(T1) as T1,
- AVG(T2) as T2,AVG(T3) as T3,AVG(T4) as T4,AVG(THDUa) as THDUa,AVG(THDUb) as THDUb,AVG(THDUc) as THDUc,AVG(Ua) as Ua,AVG(Uab) as Uab,AVG(Ub) as Ub,AVG(Ubc) as Ubc,AVG(UblU0) as UblU0,AVG(UblU2) as UblU2,
- AVG(Uc) as Uc,AVG(Uca) as Uca,AVG(Udt) as Udt,AVG(Ul) as Ul,AVG(Upt) as Upt,AVG(Ust) as Ust,FROM_UNIXTIME(UNIX_TIMESTAMP(dataTime) , '%m-%d %H:%i') as freezingTimes,dataTime
- from ht_analog_data
- <where>
- and deviceName = #{deviceCode}
- <if test="endTime != null and startTime != null and endTime != '' and startTime != ''">
- and dataTime BETWEEN #{startTime} and #{endTime}
- </if>
- </where>
- GROUP BY freezingTimes
- </select>
- <select id="yearOnYearThree" resultType="com.bizmatics.model.vo.HtAnalogDataVo">
- select
- id,deviceName,Busot,COS,COSa,COSb,COSc,Demand,DevResetTimes,DeviceTemp,Epn,Epn1,Epn2,Epn3,Epn4,Epp,
- Epp1,Epp2,Epp3,Epp4,Eqn,Eqp,F,I0,I2,IHa,IHb,IHc,Ia,Ib,Ic,Ir,LastDayMD,LastDayMDt,P,Pa,Pb,Pc,Q,Qa,Qb,Qc,SignalIntensity,
- T1,T2,T3,T4,THDUa,THDUb,THDUc,Ua,Uab,Ub,Ubc,UblU0,UblU2,Uc,Uca,Udt,Ul,Upt,Ust,FROM_UNIXTIME(UNIX_TIMESTAMP(dataTime) , '%m-%d %H:%i') as freezingTimes,dataTime
- from ht_analog_data
- <where>
- and deviceName = #{deviceCode}
- <if test="endTime != null and startTime != null and endTime != '' and startTime != ''">
- and dataTime BETWEEN #{startTime} and #{endTime}
- </if>
- </where>
- GROUP BY dataTime
- </select>
- </mapper>
|