181 lines
10 KiB
XML
181 lines
10 KiB
XML
|
|
<?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.xzzn.ems.mapper.EmsDailyEnergyDataMapper">
|
||
|
|
|
||
|
|
<resultMap type="EmsDailyEnergyData" id="EmsDailyEnergyDataResult">
|
||
|
|
<result property="id" column="id" />
|
||
|
|
<result property="siteId" column="site_id" />
|
||
|
|
<result property="dataDate" column="data_date" />
|
||
|
|
<result property="peakChargeDiff" column="peak_charge_diff" />
|
||
|
|
<result property="peakDischargeDiff" column="peak_discharge_diff" />
|
||
|
|
<result property="highChargeDiff" column="high_charge_diff" />
|
||
|
|
<result property="highDischargeDiff" column="high_discharge_diff" />
|
||
|
|
<result property="flatChargeDiff" column="flat_charge_diff" />
|
||
|
|
<result property="flatDischargeDiff" column="flat_discharge_diff" />
|
||
|
|
<result property="valleyChargeDiff" column="valley_charge_diff" />
|
||
|
|
<result property="valleyDischargeDiff" column="valley_discharge_diff" />
|
||
|
|
<result property="calcTime" column="calc_time" />
|
||
|
|
<result property="createBy" column="create_by" />
|
||
|
|
<result property="createTime" column="create_time" />
|
||
|
|
<result property="updateBy" column="update_by" />
|
||
|
|
<result property="updateTime" column="update_time" />
|
||
|
|
<result property="remark" column="remark" />
|
||
|
|
</resultMap>
|
||
|
|
|
||
|
|
<sql id="selectEmsDailyEnergyDataVo">
|
||
|
|
select id, site_id, data_date, peak_charge_diff, peak_discharge_diff, high_charge_diff, high_discharge_diff, flat_charge_diff, flat_discharge_diff, valley_charge_diff, valley_discharge_diff, calc_time, create_by, create_time, update_by, update_time, remark from ems_daily_energy_data
|
||
|
|
</sql>
|
||
|
|
|
||
|
|
<select id="selectEmsDailyEnergyDataList" parameterType="EmsDailyEnergyData" resultMap="EmsDailyEnergyDataResult">
|
||
|
|
<include refid="selectEmsDailyEnergyDataVo"/>
|
||
|
|
<where>
|
||
|
|
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
|
||
|
|
<if test="dataDate != null "> and data_date = #{dataDate}</if>
|
||
|
|
<if test="peakChargeDiff != null "> and peak_charge_diff = #{peakChargeDiff}</if>
|
||
|
|
<if test="peakDischargeDiff != null "> and peak_discharge_diff = #{peakDischargeDiff}</if>
|
||
|
|
<if test="highChargeDiff != null "> and high_charge_diff = #{highChargeDiff}</if>
|
||
|
|
<if test="highDischargeDiff != null "> and high_discharge_diff = #{highDischargeDiff}</if>
|
||
|
|
<if test="flatChargeDiff != null "> and flat_charge_diff = #{flatChargeDiff}</if>
|
||
|
|
<if test="flatDischargeDiff != null "> and flat_discharge_diff = #{flatDischargeDiff}</if>
|
||
|
|
<if test="valleyChargeDiff != null "> and valley_charge_diff = #{valleyChargeDiff}</if>
|
||
|
|
<if test="valleyDischargeDiff != null "> and valley_discharge_diff = #{valleyDischargeDiff}</if>
|
||
|
|
<if test="calcTime != null "> and calc_time = #{calcTime}</if>
|
||
|
|
</where>
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectEmsDailyEnergyDataById" parameterType="Long" resultMap="EmsDailyEnergyDataResult">
|
||
|
|
<include refid="selectEmsDailyEnergyDataVo"/>
|
||
|
|
where id = #{id}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<insert id="insertEmsDailyEnergyData" parameterType="EmsDailyEnergyData" useGeneratedKeys="true" keyProperty="id">
|
||
|
|
insert into ems_daily_energy_data
|
||
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="siteId != null">site_id,</if>
|
||
|
|
<if test="dataDate != null">data_date,</if>
|
||
|
|
<if test="peakChargeDiff != null">peak_charge_diff,</if>
|
||
|
|
<if test="peakDischargeDiff != null">peak_discharge_diff,</if>
|
||
|
|
<if test="highChargeDiff != null">high_charge_diff,</if>
|
||
|
|
<if test="highDischargeDiff != null">high_discharge_diff,</if>
|
||
|
|
<if test="flatChargeDiff != null">flat_charge_diff,</if>
|
||
|
|
<if test="flatDischargeDiff != null">flat_discharge_diff,</if>
|
||
|
|
<if test="valleyChargeDiff != null">valley_charge_diff,</if>
|
||
|
|
<if test="valleyDischargeDiff != null">valley_discharge_diff,</if>
|
||
|
|
<if test="calcTime != null">calc_time,</if>
|
||
|
|
<if test="createBy != null">create_by,</if>
|
||
|
|
<if test="createTime != null">create_time,</if>
|
||
|
|
<if test="updateBy != null">update_by,</if>
|
||
|
|
<if test="updateTime != null">update_time,</if>
|
||
|
|
<if test="remark != null">remark,</if>
|
||
|
|
</trim>
|
||
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||
|
|
<if test="siteId != null">#{siteId},</if>
|
||
|
|
<if test="dataDate != null">#{dataDate},</if>
|
||
|
|
<if test="peakChargeDiff != null">#{peakChargeDiff},</if>
|
||
|
|
<if test="peakDischargeDiff != null">#{peakDischargeDiff},</if>
|
||
|
|
<if test="highChargeDiff != null">#{highChargeDiff},</if>
|
||
|
|
<if test="highDischargeDiff != null">#{highDischargeDiff},</if>
|
||
|
|
<if test="flatChargeDiff != null">#{flatChargeDiff},</if>
|
||
|
|
<if test="flatDischargeDiff != null">#{flatDischargeDiff},</if>
|
||
|
|
<if test="valleyChargeDiff != null">#{valleyChargeDiff},</if>
|
||
|
|
<if test="valleyDischargeDiff != null">#{valleyDischargeDiff},</if>
|
||
|
|
<if test="calcTime != null">#{calcTime},</if>
|
||
|
|
<if test="createBy != null">#{createBy},</if>
|
||
|
|
<if test="createTime != null">#{createTime},</if>
|
||
|
|
<if test="updateBy != null">#{updateBy},</if>
|
||
|
|
<if test="updateTime != null">#{updateTime},</if>
|
||
|
|
<if test="remark != null">#{remark},</if>
|
||
|
|
</trim>
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<update id="updateEmsDailyEnergyData" parameterType="EmsDailyEnergyData">
|
||
|
|
update ems_daily_energy_data
|
||
|
|
<trim prefix="SET" suffixOverrides=",">
|
||
|
|
<if test="siteId != null">site_id = #{siteId},</if>
|
||
|
|
<if test="dataDate != null">data_date = #{dataDate},</if>
|
||
|
|
<if test="peakChargeDiff != null">peak_charge_diff = #{peakChargeDiff},</if>
|
||
|
|
<if test="peakDischargeDiff != null">peak_discharge_diff = #{peakDischargeDiff},</if>
|
||
|
|
<if test="highChargeDiff != null">high_charge_diff = #{highChargeDiff},</if>
|
||
|
|
<if test="highDischargeDiff != null">high_discharge_diff = #{highDischargeDiff},</if>
|
||
|
|
<if test="flatChargeDiff != null">flat_charge_diff = #{flatChargeDiff},</if>
|
||
|
|
<if test="flatDischargeDiff != null">flat_discharge_diff = #{flatDischargeDiff},</if>
|
||
|
|
<if test="valleyChargeDiff != null">valley_charge_diff = #{valleyChargeDiff},</if>
|
||
|
|
<if test="valleyDischargeDiff != null">valley_discharge_diff = #{valleyDischargeDiff},</if>
|
||
|
|
<if test="calcTime != null">calc_time = #{calcTime},</if>
|
||
|
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||
|
|
<if test="remark != null">remark = #{remark},</if>
|
||
|
|
</trim>
|
||
|
|
where id = #{id}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<delete id="deleteEmsDailyEnergyDataById" parameterType="Long">
|
||
|
|
delete from ems_daily_energy_data where id = #{id}
|
||
|
|
</delete>
|
||
|
|
|
||
|
|
<delete id="deleteEmsDailyEnergyDataByIds" parameterType="String">
|
||
|
|
delete from ems_daily_energy_data where id in
|
||
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||
|
|
#{id}
|
||
|
|
</foreach>
|
||
|
|
</delete>
|
||
|
|
|
||
|
|
<select id="getDataByDate" parameterType="String" resultMap="EmsDailyEnergyDataResult">
|
||
|
|
<include refid="selectEmsDailyEnergyDataVo"/>
|
||
|
|
where data_date = #{today}
|
||
|
|
AND site_id = #{siteId}
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<insert id="insertOrUpdateData" parameterType="com.xzzn.ems.domain.EmsDailyEnergyData"
|
||
|
|
useGeneratedKeys="true" keyProperty="id">
|
||
|
|
INSERT INTO ems_daily_energy_data (
|
||
|
|
id, site_id, data_date,
|
||
|
|
<if test="peakChargeDiff != null">peak_charge_diff,</if>
|
||
|
|
<if test="peakDischargeDiff != null">peak_discharge_diff,</if>
|
||
|
|
<if test="highChargeDiff != null">high_charge_diff,</if>
|
||
|
|
<if test="highDischargeDiff != null">high_discharge_diff,</if>
|
||
|
|
<if test="flatChargeDiff != null">flat_charge_diff,</if>
|
||
|
|
<if test="flatDischargeDiff != null">flat_discharge_diff,</if>
|
||
|
|
<if test="valleyChargeDiff != null">valley_charge_diff,</if>
|
||
|
|
<if test="valleyDischargeDiff != null">valley_discharge_diff,</if>
|
||
|
|
calc_time,
|
||
|
|
create_by,
|
||
|
|
create_time,
|
||
|
|
update_by,
|
||
|
|
update_time,
|
||
|
|
remark
|
||
|
|
) VALUES (
|
||
|
|
#{id},
|
||
|
|
#{siteId},
|
||
|
|
#{dataDate},
|
||
|
|
<if test="peakChargeDiff != null">#{peakChargeDiff},</if>
|
||
|
|
<if test="peakDischargeDiff != null">#{peakDischargeDiff},</if>
|
||
|
|
<if test="highChargeDiff != null">#{highChargeDiff},</if>
|
||
|
|
<if test="highDischargeDiff != null">#{highDischargeDiff},</if>
|
||
|
|
<if test="flatChargeDiff != null">#{flatChargeDiff},</if>
|
||
|
|
<if test="flatDischargeDiff != null">#{flatDischargeDiff},</if>
|
||
|
|
<if test="valleyChargeDiff != null">#{valleyChargeDiff},</if>
|
||
|
|
<if test="valleyDischargeDiff != null">#{valleyDischargeDiff},</if>
|
||
|
|
#{calcTime},
|
||
|
|
'system',
|
||
|
|
NOW(),
|
||
|
|
'system',
|
||
|
|
NOW(),
|
||
|
|
#{remark}
|
||
|
|
) ON DUPLICATE KEY UPDATE
|
||
|
|
<if test="peakChargeDiff != null">peak_charge_diff = #{peakChargeDiff},</if>
|
||
|
|
<if test="peakDischargeDiff != null">peak_discharge_diff = #{peakDischargeDiff},</if>
|
||
|
|
<if test="highChargeDiff != null">high_charge_diff = #{highChargeDiff},</if>
|
||
|
|
<if test="highDischargeDiff != null">high_discharge_diff = #{highDischargeDiff},</if>
|
||
|
|
<if test="flatChargeDiff != null">flat_charge_diff = #{flatChargeDiff},</if>
|
||
|
|
<if test="flatDischargeDiff != null">flat_discharge_diff = #{flatDischargeDiff},</if>
|
||
|
|
<if test="valleyChargeDiff != null">valley_charge_diff = #{valleyChargeDiff},</if>
|
||
|
|
<if test="valleyDischargeDiff != null">valley_discharge_diff = #{valleyDischargeDiff},</if>
|
||
|
|
calc_time = #{calcTime},
|
||
|
|
update_time = NOW();
|
||
|
|
</insert>
|
||
|
|
</mapper>
|