电价配置-增加站点id

This commit is contained in:
2025-10-11 16:28:50 +08:00
parent e33b26fc05
commit b79f9caa2d
9 changed files with 76 additions and 22 deletions

View File

@ -6,6 +6,7 @@
<resultMap type="EmsEnergyPriceConfig" id="EmsEnergyPriceConfigResult">
<result property="id" column="id" />
<result property="siteId" column="site_id" />
<result property="year" column="year" />
<result property="month" column="month" />
<result property="peak" column="peak" />
@ -20,19 +21,19 @@
</resultMap>
<sql id="selectEmsEnergyPriceConfigVo">
select id, year, month, peak, high, flat, valley, create_by, create_time, update_by, update_time, remark from ems_energy_price_config
select id, site_id, year, month, peak, high, flat, valley, create_by, create_time, update_by, update_time, remark from ems_energy_price_config
</sql>
<select id="selectEmsEnergyPriceConfigList" parameterType="EmsEnergyPriceConfig" resultMap="EmsEnergyPriceConfigResult">
<include refid="selectEmsEnergyPriceConfigVo"/>
<where>
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
<if test="year != null and year != ''"> and year = #{year}</if>
<if test="month != null and month != ''"> and month = #{month}</if>
<if test="peak != null "> and peak = #{peak}</if>
<if test="high != null "> and high = #{high}</if>
<if test="flat != null "> and flat = #{flat}</if>
<if test="valley != null "> and valley = #{valley}</if>
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
</where>
</select>
@ -44,6 +45,7 @@
<insert id="insertEmsEnergyPriceConfig" parameterType="EmsEnergyPriceConfig" useGeneratedKeys="true" keyProperty="id">
insert into ems_energy_price_config
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="siteId != null">site_id,</if>
<if test="year != null and year != ''">year,</if>
<if test="month != null and month != ''">month,</if>
<if test="peak != null">peak,</if>
@ -57,6 +59,7 @@
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="siteId != null">#{siteId},</if>
<if test="year != null and year != ''">#{year},</if>
<if test="month != null and month != ''">#{month},</if>
<if test="peak != null">#{peak},</if>
@ -74,6 +77,7 @@
<update id="updateEmsEnergyPriceConfig" parameterType="EmsEnergyPriceConfig">
update ems_energy_price_config
<trim prefix="SET" suffixOverrides=",">
<if test="siteId != null">site_id = #{siteId},</if>
<if test="year != null and year != ''">year = #{year},</if>
<if test="month != null and month != ''">month = #{month},</if>
<if test="peak != null">peak = #{peak},</if>
@ -104,6 +108,9 @@
<include refid="selectEmsEnergyPriceConfigVo"/>
<where>
year = #{currentYear}
<if test="siteId != null and siteId != ''">
and site_id = #{siteId}
</if>
</where>
</select>
@ -111,6 +118,7 @@
useGeneratedKeys="true" keyProperty="id">
INSERT INTO ems_energy_price_config (
id,
site_id,
year,
month,
peak,
@ -124,6 +132,7 @@
remark
) VALUES (
#{id},
#{siteId},
#{year},
#{month},
#{peak},
@ -145,7 +154,8 @@
<select id="getConfigListByYearAndMonth" resultMap="EmsEnergyPriceConfigResult">
<include refid="selectEmsEnergyPriceConfigVo"/>
where year = #{currentYear}
where site_id = #{siteId}
and year = #{currentYear}
and month = #{month}
</select>
@ -155,7 +165,8 @@
t2.end_time as endTime
from ems_energy_price_config t
left join ems_price_time_config t2 on t.id = t2.price_id
where t.`year` = #{currentYear}
where t.site_id = #{siteId}
and t.`year` = #{currentYear}
and t.`month` = #{currentMonth}
</select>
</mapper>