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.EmsStrategyTempMapper">
|
|
|
|
|
|
|
|
|
|
<resultMap type="EmsStrategyTemp" id="EmsStrategyTempResult">
|
|
|
|
|
<result property="id" column="id" />
|
|
|
|
|
<result property="strategyId" column="strategy_id" />
|
|
|
|
|
<result property="templateName" column="template_name" />
|
|
|
|
|
<result property="sdcLimit" column="sdc_limit" />
|
|
|
|
|
<result property="sdcDown" column="sdc_down" />
|
|
|
|
|
<result property="sdcUp" column="sdc_up" />
|
|
|
|
|
<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" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectEmsStrategyTempVo">
|
2025-07-12 18:51:23 +08:00
|
|
|
select id, strategy_id, template_name, sdc_limit, sdc_down, sdc_up, create_by, create_time, update_by, update_time, remark, site_id from ems_strategy_temp
|
2025-07-11 19:47:15 +08:00
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectEmsStrategyTempList" parameterType="EmsStrategyTemp" resultMap="EmsStrategyTempResult">
|
|
|
|
|
<include refid="selectEmsStrategyTempVo"/>
|
|
|
|
|
<where>
|
|
|
|
|
<if test="strategyId != null "> and strategy_id = #{strategyId}</if>
|
|
|
|
|
<if test="templateName != null and templateName != ''"> and template_name like concat('%', #{templateName}, '%')</if>
|
|
|
|
|
<if test="sdcLimit != null "> and sdc_limit = #{sdcLimit}</if>
|
|
|
|
|
<if test="sdcDown != null "> and sdc_down = #{sdcDown}</if>
|
|
|
|
|
<if test="sdcUp != null "> and sdc_up = #{sdcUp}</if>
|
|
|
|
|
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectEmsStrategyTempById" parameterType="Long" resultMap="EmsStrategyTempResult">
|
|
|
|
|
<include refid="selectEmsStrategyTempVo"/>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertEmsStrategyTemp" parameterType="EmsStrategyTemp" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
insert into ems_strategy_temp
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="strategyId != null">strategy_id,</if>
|
|
|
|
|
<if test="templateName != null">template_name,</if>
|
|
|
|
|
<if test="sdcLimit != null">sdc_limit,</if>
|
|
|
|
|
<if test="sdcDown != null">sdc_down,</if>
|
|
|
|
|
<if test="sdcUp != null">sdc_up,</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>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="strategyId != null">#{strategyId},</if>
|
|
|
|
|
<if test="templateName != null">#{templateName},</if>
|
|
|
|
|
<if test="sdcLimit != null">#{sdcLimit},</if>
|
|
|
|
|
<if test="sdcDown != null">#{sdcDown},</if>
|
|
|
|
|
<if test="sdcUp != null">#{sdcUp},</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>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="updateEmsStrategyTemp" parameterType="EmsStrategyTemp">
|
|
|
|
|
update ems_strategy_temp
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="strategyId != null">strategy_id = #{strategyId},</if>
|
|
|
|
|
<if test="templateName != null">template_name = #{templateName},</if>
|
|
|
|
|
<if test="sdcLimit != null">sdc_limit = #{sdcLimit},</if>
|
|
|
|
|
<if test="sdcDown != null">sdc_down = #{sdcDown},</if>
|
|
|
|
|
<if test="sdcUp != null">sdc_up = #{sdcUp},</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>
|
|
|
|
|
</trim>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteEmsStrategyTempById" parameterType="Long">
|
|
|
|
|
delete from ems_strategy_temp where id = #{id}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteEmsStrategyTempByIds" parameterType="String">
|
|
|
|
|
delete from ems_strategy_temp where id in
|
|
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
|
2025-07-12 18:51:23 +08:00
|
|
|
<select id="getTempNameList" resultType="Map">
|
|
|
|
|
select DISTINCT id as templateId,template_name as templateName
|
2025-07-11 19:47:15 +08:00
|
|
|
from ems_strategy_temp
|
|
|
|
|
where site_id = #{siteId}
|
|
|
|
|
and strategy_id = #{strategyId}
|
|
|
|
|
</select>
|
2025-07-12 18:51:23 +08:00
|
|
|
|
|
|
|
|
<select id="getStrategyTempByTempId" parameterType="String" resultType="int">
|
|
|
|
|
select count(1) from ems_strategy_temp where template_id = #{templateId}
|
|
|
|
|
</select>
|
2025-07-11 19:47:15 +08:00
|
|
|
</mapper>
|