You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
514 lines
19 KiB
514 lines
19 KiB
<?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.psdc.mapper.PsdcElectricHtdataMapper">
|
|
<resultMap type="com.psdc.entity.PsdcElectricHtdata" id="PsdcElectricHtdataMap">
|
|
<result property="electricHtdataId" column="electric_htdata_id" />
|
|
<result property="deviceId" column="device_id" />
|
|
<result property="updateTime" column="update_time" />
|
|
<result property="useDeiffen" column="use_deiffen" />
|
|
<result property="ua" column="Ua" />
|
|
<result property="ub" column="Ub" />
|
|
<result property="uc" column="Uc" />
|
|
<result property="ia" column="Ia" />
|
|
<result property="ib" column="Ib" />
|
|
<result property="ic" column="Ic" />
|
|
<result property="pa" column="Pa" />
|
|
<result property="pb" column="Pb" />
|
|
<result property="pc" column="Pc" />
|
|
<result property="totp" column="TotP" />
|
|
<result property="qa" column="Qa" />
|
|
<result property="qb" column="Qb" />
|
|
<result property="qc" column="Qc" />
|
|
<result property="totq" column="TotQ" />
|
|
<result property="pfa" column="PFa" />
|
|
<result property="pfb" column="PFb" />
|
|
<result property="pfc" column="PFc" />
|
|
<result property="totpf" column="TotPF" />
|
|
<result property="supwh" column="SupWh" />
|
|
<result property="rtlwh" column="RtlWh" />
|
|
<result property="supqh" column="SupQh" />
|
|
<result property="rtlqh" column="RtlQh" />
|
|
<result property="sa" column="Sa" />
|
|
<result property="sb" column="Sb" />
|
|
<result property="sc" column="Sc" />
|
|
<result property="tots" column="TotS" />
|
|
<result property="totwh" column="TotWh" />
|
|
<result property="totwh1" column="TotWh_1" />
|
|
<result property="totwh2" column="TotWh_2" />
|
|
<result property="totwh3" column="TotWh_3" />
|
|
<result property="totwh4" column="TotWh_4" />
|
|
<result property="hz" column="HZ" />
|
|
<result property="uab" column="Uab" />
|
|
<result property="ubc" column="Ubc" />
|
|
<result property="uca" column="Uca" />
|
|
<result property="combwh" column="CombWh" />
|
|
<result property="combqh" column="CombQh" />
|
|
</resultMap>
|
|
|
|
<resultMap id="PsdcElectricHtdataMap2" type="com.psdc.entity.res.TodayThisHourUseElectricInfoRes">
|
|
<result property="id" column="electric_htdata_id" />
|
|
<result property="hour" column="hour" />
|
|
<result property="deviceId" column="device_id" />
|
|
<result property="simDate" column="data" />
|
|
<result property="upDateTime" column="update_time" />
|
|
<result property="useElectric" column="use_deiffen" />
|
|
</resultMap>
|
|
|
|
<!-- 通过ID查询单条数据 -->
|
|
<select id="queryById" resultMap="PsdcElectricHtdataMap">
|
|
select
|
|
electric_htdata_id,device_id,update_time,use_deiffen,Ua,Ub,Uc,Ia,Ib,Ic,Pa,Pb,Pc,TotP,Qa,Qb,Qc,TotQ,PFa,PFb,PFc,TotPF,SupWh,RtlWh,SupQh,RtlQh,Sa,Sb,Sc,TotS,
|
|
TotWh,TotWh_1,TotWh_2,TotWh_3,TotWh_4,HZ,Uab,Ubc,Uca,CombWh,CombQh
|
|
from psdc_electric_htdata
|
|
where electric_htdata_id = #{electricHtdataId}
|
|
</select>
|
|
|
|
<select id="selThisHourUseElectric" resultMap="PsdcElectricHtdataMap2">
|
|
Select electric_htdata_id ,dt.time As `hour`,device_id,DATE_FORMAT(update_time,'%H:%i:%S') As `update_time`,
|
|
IFNULL(SUM(use_deiffen),0) As use_deiffen
|
|
From psdc_datetime dt
|
|
Left Join psdc_electric_htdata peht On dt.time = DATE_FORMAT(update_time,'%H')
|
|
And device_id = ${deviceId} And DATE_FORMAT(update_time,'%Y-%m-%d') = #{upDate}
|
|
Where dt.time is Not Null
|
|
Group By dt.time
|
|
Order By dt.time
|
|
</select>
|
|
|
|
<select id="selThisDayUseElectric" resultMap="PsdcElectricHtdataMap2">
|
|
Select electric_htdata_id ,dt.`data`, device_id, IFNULL(SUM(use_deiffen),0.0) as use_deiffen
|
|
From psdc_datetime dt
|
|
Left Join psdc_electric_htdata peht On dt.data = DATE_FORMAT(peht.update_time,'%Y-%m-%d')
|
|
And peht.device_id = ${deviceId}
|
|
Where dt.data is Not null
|
|
And date_format(dt.`data`,'%Y-%m') = #{upDate}
|
|
GROUP By dt.data
|
|
ORDER By dt.data
|
|
</select>
|
|
|
|
|
|
|
|
<select id="selTodayUseEnergy" resultType="java.lang.Double">
|
|
Select SUM(use_deiffen) From psdc_electric_htdata
|
|
<where>
|
|
<if test="deviceId != null and deviceId != ''">
|
|
device_id = #{deviceId}
|
|
</if>
|
|
<if test="beginTime != null and beginTime != ''"><!-- 开始时间检索 -->
|
|
And date_format(update_time,'%Y-%m-%d %H:%i:%S') >= date_format(#{beginTime},'%Y-%m-%d %H:%i:%S')
|
|
</if>
|
|
<if test="endTime != null and endTime != ''"><!-- 结束时间检索 -->
|
|
And date_format(update_time,'%Y-%m-%d %H:%i:%S') <= date_format(#{endTime},'%Y-%m-%d %H:%i:%S')
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
|
|
<!--分页查询指定行数据-->
|
|
<select id="queryAllByLimit" resultMap="PsdcElectricHtdataMap">
|
|
select
|
|
electric_htdata_id,device_id,update_time,use_deiffen,Ua,Ub,Uc,Ia,Ib,Ic,Pa,Pb,Pc,TotP,Qa,Qb,Qc,TotQ,PFa,PFb,PFc,TotPF,SupWh,RtlWh,SupQh,RtlQh,Sa,Sb,Sc,TotS,
|
|
TotWh,TotWh_1,TotWh_2,TotWh_3,TotWh_4,HZ,Uab,Ubc,Uca,CombWh,CombQh
|
|
from psdc_electric_htdata
|
|
<where>
|
|
<if test="electricRtdataId != null and electricRtdataId != ''">
|
|
and electric_htdata_id = #{electricHtdataId}
|
|
</if>
|
|
<if test="deviceId != null and deviceId != ''">
|
|
and device_id = #{deviceId}
|
|
</if>
|
|
<if test="updateTime != null and updateTime != ''">
|
|
and update_time = #{updateTime}
|
|
</if>
|
|
<if test="useDeiffen != null and useDeiffen != ''">
|
|
and use_deiffen = #{useDeiffen}
|
|
</if>
|
|
<if test="ua != null and ua != ''">
|
|
and Ua = #{ua}
|
|
</if>
|
|
<if test="ub != null and ub != ''">
|
|
and Ub = #{ub}
|
|
</if>
|
|
<if test="uc != null and uc != ''">
|
|
and Uc = #{uc}
|
|
</if>
|
|
<if test="ia != null and ia != ''">
|
|
and Ia = #{ia}
|
|
</if>
|
|
<if test="ib != null and ib != ''">
|
|
and Ib = #{ib}
|
|
</if>
|
|
<if test="ic != null and ic != ''">
|
|
and Ic = #{ic}
|
|
</if>
|
|
<if test="pa != null and pa != ''">
|
|
and Pa = #{pa}
|
|
</if>
|
|
<if test="pb != null and pb != ''">
|
|
and Pb = #{pb}
|
|
</if>
|
|
<if test="pc != null and pc != ''">
|
|
and Pc = #{pc}
|
|
</if>
|
|
<if test="totp != null and totp != ''">
|
|
and TotP = #{totp}
|
|
</if>
|
|
<if test="qa != null and qa != ''">
|
|
and Qa = #{qa}
|
|
</if>
|
|
<if test="qb != null and qb != ''">
|
|
and Qb = #{qb}
|
|
</if>
|
|
<if test="qc != null and qc != ''">
|
|
and Qc = #{qc}
|
|
</if>
|
|
<if test="totq != null and totq != ''">
|
|
and TotQ = #{totq}
|
|
</if>
|
|
<if test="pfa != null and pfa != ''">
|
|
and PFa = #{pfa}
|
|
</if>
|
|
<if test="pfb != null and pfb != ''">
|
|
and PFb = #{pfb}
|
|
</if>
|
|
<if test="pfc != null and pfc != ''">
|
|
and PFc = #{pfc}
|
|
</if>
|
|
<if test="totpf != null and totpf != ''">
|
|
and TotPF = #{totpf}
|
|
</if>
|
|
<if test="supwh != null and supwh != ''">
|
|
and SupWh = #{supwh}
|
|
</if>
|
|
<if test="rtlwh != null and rtlwh != ''">
|
|
and RtlWh = #{rtlwh}
|
|
</if>
|
|
<if test="supqh != null and supqh != ''">
|
|
and SupQh = #{supqh}
|
|
</if>
|
|
<if test="rtlqh != null and rtlqh != ''">
|
|
and RtlQh = #{rtlqh}
|
|
</if>
|
|
<if test="sa != null and sa != ''">
|
|
and Sa = #{sa}
|
|
</if>
|
|
<if test="sb != null and sb != ''">
|
|
and Sb = #{sb}
|
|
</if>
|
|
<if test="sc != null and sc != ''">
|
|
and Sc = #{sc}
|
|
</if>
|
|
<if test="tots != null and tots != ''">
|
|
and TotS = #{tots}
|
|
</if>
|
|
<if test="totwh != null and totwh != ''">
|
|
and TotWh = #{totwh}
|
|
</if>
|
|
<if test="totwh1 != null and totwh1 != ''">
|
|
and TotWh_1 = #{totwh1}
|
|
</if>
|
|
<if test="totwh2 != null and totwh2 != ''">
|
|
and TotWh_2 = #{totwh2}
|
|
</if>
|
|
<if test="totwh3 != null and totwh3 != ''">
|
|
and TotWh_3 = #{totwh3}
|
|
</if>
|
|
<if test="totwh4 != null and totwh4 != ''">
|
|
and TotWh_4 = #{totwh4}
|
|
</if>
|
|
<if test="hz != null and hz != ''">
|
|
and HZ = #{hz}
|
|
</if>
|
|
<if test="uab != null and uab != ''">
|
|
and Uab = #{uab}
|
|
</if>
|
|
<if test="ubc != null and ubc != ''">
|
|
and Ubc = #{ubc}
|
|
</if>
|
|
<if test="uca != null and uca != ''">
|
|
and Uca = #{uca}
|
|
</if>
|
|
<if test="combwh != null and combwh != ''">
|
|
and CombWh = #{combwh}
|
|
</if>
|
|
<if test="combqh != null and combqh != ''">
|
|
and CombQh = #{combqh}
|
|
</if>
|
|
</where>
|
|
limit #{pageable.offset}, #{pageable.pageSize}
|
|
</select>
|
|
|
|
<!--统计总行数-->
|
|
<select id="count" resultType="java.lang.Long">
|
|
select count(1)
|
|
from psdc_electric_htdata
|
|
<where>
|
|
<if test="electricRtdataId != null and electricRtdataId != ''">
|
|
and electric_rtdata_id = #{electricHtdataId}
|
|
</if>
|
|
<if test="deviceId != null and deviceId != ''">
|
|
and device_id = #{deviceId}
|
|
</if>
|
|
<if test="updateTime != null and updateTime != ''">
|
|
and update_time = #{updateTime}
|
|
</if>
|
|
<if test="useDeiffen != null and useDeiffen != ''">
|
|
and use_deiffen = #{useDeiffen}
|
|
</if>
|
|
<if test="ua != null and ua != ''">
|
|
and Ua = #{ua}
|
|
</if>
|
|
<if test="ub != null and ub != ''">
|
|
and Ub = #{ub}
|
|
</if>
|
|
<if test="uc != null and uc != ''">
|
|
and Uc = #{uc}
|
|
</if>
|
|
<if test="ia != null and ia != ''">
|
|
and Ia = #{ia}
|
|
</if>
|
|
<if test="ib != null and ib != ''">
|
|
and Ib = #{ib}
|
|
</if>
|
|
<if test="ic != null and ic != ''">
|
|
and Ic = #{ic}
|
|
</if>
|
|
<if test="pa != null and pa != ''">
|
|
and Pa = #{pa}
|
|
</if>
|
|
<if test="pb != null and pb != ''">
|
|
and Pb = #{pb}
|
|
</if>
|
|
<if test="pc != null and pc != ''">
|
|
and Pc = #{pc}
|
|
</if>
|
|
<if test="totp != null and totp != ''">
|
|
and TotP = #{totp}
|
|
</if>
|
|
<if test="qa != null and qa != ''">
|
|
and Qa = #{qa}
|
|
</if>
|
|
<if test="qb != null and qb != ''">
|
|
and Qb = #{qb}
|
|
</if>
|
|
<if test="qc != null and qc != ''">
|
|
and Qc = #{qc}
|
|
</if>
|
|
<if test="totq != null and totq != ''">
|
|
and TotQ = #{totq}
|
|
</if>
|
|
<if test="pfa != null and pfa != ''">
|
|
and PFa = #{pfa}
|
|
</if>
|
|
<if test="pfb != null and pfb != ''">
|
|
and PFb = #{pfb}
|
|
</if>
|
|
<if test="pfc != null and pfc != ''">
|
|
and PFc = #{pfc}
|
|
</if>
|
|
<if test="totpf != null and totpf != ''">
|
|
and TotPF = #{totpf}
|
|
</if>
|
|
<if test="supwh != null and supwh != ''">
|
|
and SupWh = #{supwh}
|
|
</if>
|
|
<if test="rtlwh != null and rtlwh != ''">
|
|
and RtlWh = #{rtlwh}
|
|
</if>
|
|
<if test="supqh != null and supqh != ''">
|
|
and SupQh = #{supqh}
|
|
</if>
|
|
<if test="rtlqh != null and rtlqh != ''">
|
|
and RtlQh = #{rtlqh}
|
|
</if>
|
|
<if test="sa != null and sa != ''">
|
|
and Sa = #{sa}
|
|
</if>
|
|
<if test="sb != null and sb != ''">
|
|
and Sb = #{sb}
|
|
</if>
|
|
<if test="sc != null and sc != ''">
|
|
and Sc = #{sc}
|
|
</if>
|
|
<if test="tots != null and tots != ''">
|
|
and TotS = #{tots}
|
|
</if>
|
|
<if test="totwh != null and totwh != ''">
|
|
and TotWh = #{totwh}
|
|
</if>
|
|
<if test="totwh1 != null and totwh1 != ''">
|
|
and TotWh_1 = #{totwh1}
|
|
</if>
|
|
<if test="totwh2 != null and totwh2 != ''">
|
|
and TotWh_2 = #{totwh2}
|
|
</if>
|
|
<if test="totwh3 != null and totwh3 != ''">
|
|
and TotWh_3 = #{totwh3}
|
|
</if>
|
|
<if test="totwh4 != null and totwh4 != ''">
|
|
and TotWh_4 = #{totwh4}
|
|
</if>
|
|
<if test="hz != null and hz != ''">
|
|
and HZ = #{hz}
|
|
</if>
|
|
<if test="uab != null and uab != ''">
|
|
and Uab = #{uab}
|
|
</if>
|
|
<if test="ubc != null and ubc != ''">
|
|
and Ubc = #{ubc}
|
|
</if>
|
|
<if test="uca != null and uca != ''">
|
|
and Uca = #{uca}
|
|
</if>
|
|
<if test="combwh != null and combwh != ''">
|
|
and CombWh = #{combwh}
|
|
</if>
|
|
<if test="combqh != null and combqh != ''">
|
|
and CombQh = #{combqh}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!--新增数据-->
|
|
<insert id="insert">
|
|
insert into psdc_electric_htdata(electric_htdata_id,device_id,update_time,use_deiffen,Ua,Ub,Uc,Ia,Ib,Ic,Pa,Pb,Pc,TotP,Qa,Qb,Qc,TotQ,PFa,PFb,PFc,TotPF,SupWh,RtlWh,SupQh,RtlQh,Sa,Sb,Sc,TotS,
|
|
TotWh,TotWh_1,TotWh_2,TotWh_3,TotWh_4,HZ,Uab,Ubc,Uca,CombWh,CombQh)
|
|
values (#{electricHtdataId},#{deviceId},#{updateTime},#{useDeiffen},#{ua},#{ub},#{uc},#{ia},#{ib},#{ic},#{pa},#{pb},#{pc},#{totp},#{qa},#{qb},#{qc},#{totq},#{pfa},#{pfb},#{pfc},#{totpf},#{supwh},#{rtlwh},#{supqh},#{rtlqh},#{sa},#{sb},#{sc},#{tots},#{
|
|
totwh},#{totwh1},#{totwh2},#{totwh3},#{totwh4},#{hz},#{uab},#{ubc},#{uca},#{combwh},#{combqh})
|
|
</insert>
|
|
|
|
<!-- 更新数据 -->
|
|
<update id="update">
|
|
update psdc_electric_htdata
|
|
<set>
|
|
<if test="electricRtdataId != null and electricRtdataId != ''">
|
|
electric_htdata_id = #{electricHtdataId},
|
|
</if>
|
|
<if test="deviceId != null and deviceId != ''">
|
|
device_id = #{deviceId},
|
|
</if>
|
|
<if test="updateTime != null and updateTime != ''">
|
|
update_time = #{updateTime},
|
|
</if>
|
|
<if test="useDeiffen != null and useDeiffen != ''">
|
|
use_deiffen = #{useDeiffen},
|
|
</if>
|
|
<if test="ua != null and ua != ''">
|
|
Ua = #{ua},
|
|
</if>
|
|
<if test="ub != null and ub != ''">
|
|
Ub = #{ub},
|
|
</if>
|
|
<if test="uc != null and uc != ''">
|
|
Uc = #{uc},
|
|
</if>
|
|
<if test="ia != null and ia != ''">
|
|
Ia = #{ia},
|
|
</if>
|
|
<if test="ib != null and ib != ''">
|
|
Ib = #{ib},
|
|
</if>
|
|
<if test="ic != null and ic != ''">
|
|
Ic = #{ic},
|
|
</if>
|
|
<if test="pa != null and pa != ''">
|
|
Pa = #{pa},
|
|
</if>
|
|
<if test="pb != null and pb != ''">
|
|
Pb = #{pb},
|
|
</if>
|
|
<if test="pc != null and pc != ''">
|
|
Pc = #{pc},
|
|
</if>
|
|
<if test="totp != null and totp != ''">
|
|
TotP = #{totp},
|
|
</if>
|
|
<if test="qa != null and qa != ''">
|
|
Qa = #{qa},
|
|
</if>
|
|
<if test="qb != null and qb != ''">
|
|
Qb = #{qb},
|
|
</if>
|
|
<if test="qc != null and qc != ''">
|
|
Qc = #{qc},
|
|
</if>
|
|
<if test="totq != null and totq != ''">
|
|
TotQ = #{totq},
|
|
</if>
|
|
<if test="pfa != null and pfa != ''">
|
|
PFa = #{pfa},
|
|
</if>
|
|
<if test="pfb != null and pfb != ''">
|
|
PFb = #{pfb},
|
|
</if>
|
|
<if test="pfc != null and pfc != ''">
|
|
PFc = #{pfc},
|
|
</if>
|
|
<if test="totpf != null and totpf != ''">
|
|
TotPF = #{totpf},
|
|
</if>
|
|
<if test="supwh != null and supwh != ''">
|
|
SupWh = #{supwh},
|
|
</if>
|
|
<if test="rtlwh != null and rtlwh != ''">
|
|
RtlWh = #{rtlwh},
|
|
</if>
|
|
<if test="supqh != null and supqh != ''">
|
|
SupQh = #{supqh},
|
|
</if>
|
|
<if test="rtlqh != null and rtlqh != ''">
|
|
RtlQh = #{rtlqh},
|
|
</if>
|
|
<if test="sa != null and sa != ''">
|
|
Sa = #{sa},
|
|
</if>
|
|
<if test="sb != null and sb != ''">
|
|
Sb = #{sb},
|
|
</if>
|
|
<if test="sc != null and sc != ''">
|
|
Sc = #{sc},
|
|
</if>
|
|
<if test="tots != null and tots != ''">
|
|
TotS = #{tots},
|
|
</if>
|
|
<if test="totwh != null and totwh != ''">
|
|
TotWh = #{totwh},
|
|
</if>
|
|
<if test="totwh1 != null and totwh1 != ''">
|
|
TotWh_1 = #{totwh1},
|
|
</if>
|
|
<if test="totwh2 != null and totwh2 != ''">
|
|
TotWh_2 = #{totwh2},
|
|
</if>
|
|
<if test="totwh3 != null and totwh3 != ''">
|
|
TotWh_3 = #{totwh3},
|
|
</if>
|
|
<if test="totwh4 != null and totwh4 != ''">
|
|
TotWh_4 = #{totwh4},
|
|
</if>
|
|
<if test="hz != null and hz != ''">
|
|
HZ = #{hz},
|
|
</if>
|
|
<if test="uab != null and uab != ''">
|
|
Uab = #{uab},
|
|
</if>
|
|
<if test="ubc != null and ubc != ''">
|
|
Ubc = #{ubc},
|
|
</if>
|
|
<if test="uca != null and uca != ''">
|
|
Uca = #{uca},
|
|
</if>
|
|
<if test="combwh != null and combwh != ''">
|
|
CombWh = #{combwh},
|
|
</if>
|
|
<if test="combqh != null and combqh != ''">
|
|
CombQh = #{combqh},
|
|
</if>
|
|
</set>
|
|
where electric_htdata_id = #{electricHtdataId}
|
|
</update>
|
|
|
|
<!--通过主键删除-->
|
|
<delete id="deleteById">
|
|
delete from psdc_electric_htdata where electric_htdata_id = #{electricHtdataId}
|
|
</delete>
|
|
</mapper> |