2025-07-11 19:47:15 +08:00
|
|
|
<?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.EmsStrategyTimeConfigMapper">
|
|
|
|
|
|
|
|
|
|
<resultMap type="EmsStrategyTimeConfig" id="EmsStrategyTimeConfigResult">
|
|
|
|
|
<result property="id" column="id" />
|
|
|
|
|
<result property="strategyId" column="strategy_id" />
|
|
|
|
|
<result property="month" column="month" />
|
|
|
|
|
<result property="chargeDischargeMode" column="charge_discharge_mode" />
|
|
|
|
|
<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" />
|
|
|
|
|
<result property="siteId" column="site_id" />
|
2025-07-12 18:51:23 +08:00
|
|
|
<result property="templateId" column="template_id" />
|
2025-07-11 19:47:15 +08:00
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectEmsStrategyTimeConfigVo">
|
2025-07-12 18:51:23 +08:00
|
|
|
select id, strategy_id, month, charge_discharge_mode, create_by, create_time, update_by, update_time, remark, site_id, template_id from ems_strategy_time_config
|
2025-07-11 19:47:15 +08:00
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectEmsStrategyTimeConfigList" parameterType="EmsStrategyTimeConfig" resultMap="EmsStrategyTimeConfigResult">
|
|
|
|
|
<include refid="selectEmsStrategyTimeConfigVo"/>
|
|
|
|
|
<where>
|
|
|
|
|
<if test="strategyId != null "> and strategy_id = #{strategyId}</if>
|
|
|
|
|
<if test="month != null "> and month = #{month}</if>
|
|
|
|
|
<if test="chargeDischargeMode != null and chargeDischargeMode != ''"> and charge_discharge_mode = #{chargeDischargeMode}</if>
|
|
|
|
|
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
|
2025-07-13 14:14:07 +08:00
|
|
|
<if test="templateId != null and templateId != ''"> and template_id = #{templateId}</if>
|
2025-07-11 19:47:15 +08:00
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectEmsStrategyTimeConfigById" parameterType="Long" resultMap="EmsStrategyTimeConfigResult">
|
|
|
|
|
<include refid="selectEmsStrategyTimeConfigVo"/>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertEmsStrategyTimeConfig" parameterType="EmsStrategyTimeConfig" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
insert into ems_strategy_time_config
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="strategyId != null">strategy_id,</if>
|
|
|
|
|
<if test="month != null">month,</if>
|
|
|
|
|
<if test="chargeDischargeMode != null">charge_discharge_mode,</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>
|
|
|
|
|
<if test="siteId != null">site_id,</if>
|
2025-07-12 18:51:23 +08:00
|
|
|
<if test="templateId != null">template_id,</if>
|
2025-07-11 19:47:15 +08:00
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="strategyId != null">#{strategyId},</if>
|
|
|
|
|
<if test="month != null">#{month},</if>
|
|
|
|
|
<if test="chargeDischargeMode != null">#{chargeDischargeMode},</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>
|
|
|
|
|
<if test="siteId != null">#{siteId},</if>
|
2025-07-12 18:51:23 +08:00
|
|
|
<if test="templateId != null">#{templateId},</if>
|
2025-07-11 19:47:15 +08:00
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="updateEmsStrategyTimeConfig" parameterType="EmsStrategyTimeConfig">
|
|
|
|
|
update ems_strategy_time_config
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="strategyId != null">strategy_id = #{strategyId},</if>
|
|
|
|
|
<if test="month != null">month = #{month},</if>
|
|
|
|
|
<if test="chargeDischargeMode != null">charge_discharge_mode = #{chargeDischargeMode},</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>
|
|
|
|
|
<if test="siteId != null">site_id = #{siteId},</if>
|
2025-07-12 18:51:23 +08:00
|
|
|
<if test="templateId != null">template_id = #{templateId},</if>
|
2025-07-11 19:47:15 +08:00
|
|
|
</trim>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteEmsStrategyTimeConfigById" parameterType="Long">
|
|
|
|
|
delete from ems_strategy_time_config where id = #{id}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteEmsStrategyTimeConfigByIds" parameterType="String">
|
|
|
|
|
delete from ems_strategy_time_config where id in
|
|
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
2025-07-13 00:42:43 +08:00
|
|
|
|
|
|
|
|
<select id="getStrategyTimeList" parameterType="EmsStrategyTimeConfig" resultType="com.xzzn.ems.domain.vo.StrategyTimeConfigVo">
|
2025-07-13 15:27:38 +08:00
|
|
|
select distinct t.id,
|
2025-07-13 00:42:43 +08:00
|
|
|
t.month,
|
|
|
|
|
t.charge_discharge_mode as chargeDischargeMode,
|
|
|
|
|
t.template_id as templateId,
|
|
|
|
|
temp.template_name as templateName
|
|
|
|
|
from ems_strategy_time_config t
|
2025-07-13 15:02:00 +08:00
|
|
|
LEFT JOIN ems_strategy_temp temp on t.template_id = temp.template_id
|
2025-07-13 00:42:43 +08:00
|
|
|
where t.site_id = #{siteId}
|
|
|
|
|
and t.strategy_id = #{strategyId}
|
|
|
|
|
order by month
|
|
|
|
|
</select>
|
|
|
|
|
|
2025-07-13 16:27:31 +08:00
|
|
|
<update id="cleanTemplateId" parameterType="String">
|
|
|
|
|
update ems_strategy_time_config set template_id = '' where template_id = #{templateId}
|
|
|
|
|
</update>
|
2025-07-11 19:47:15 +08:00
|
|
|
</mapper>
|