2025-07-10 22:30:56 +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.EmsStrategyRunningMapper">
|
|
|
|
|
|
|
|
|
|
<resultMap type="EmsStrategyRunning" id="EmsStrategyRunningResult">
|
|
|
|
|
<result property="id" column="id" />
|
|
|
|
|
<result property="mainStrategyId" column="main_strategy_id" />
|
|
|
|
|
<result property="auxiliaryStrategyId" column="auxiliary_strategy_id" />
|
|
|
|
|
<result property="status" column="status" />
|
|
|
|
|
<result property="createTime" column="create_time" />
|
|
|
|
|
<result property="updateTime" column="update_time" />
|
|
|
|
|
<result property="siteId" column="site_id" />
|
|
|
|
|
<result property="deviceId" column="device_id" />
|
|
|
|
|
<result property="remark" column="remark" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectEmsStrategyRunningVo">
|
|
|
|
|
select id, main_strategy_id, auxiliary_strategy_id, status, create_time, update_time, site_id, device_id, remark from ems_strategy_running
|
|
|
|
|
</sql>
|
|
|
|
|
|
|
|
|
|
<select id="selectEmsStrategyRunningList" parameterType="EmsStrategyRunning" resultMap="EmsStrategyRunningResult">
|
|
|
|
|
<include refid="selectEmsStrategyRunningVo"/>
|
|
|
|
|
<where>
|
|
|
|
|
<if test="mainStrategyId != null "> and main_strategy_id = #{mainStrategyId}</if>
|
|
|
|
|
<if test="auxiliaryStrategyId != null "> and auxiliary_strategy_id = #{auxiliaryStrategyId}</if>
|
|
|
|
|
<if test="status != null and status != ''"> and status = #{status}</if>
|
|
|
|
|
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
|
|
|
|
|
<if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
|
|
|
|
|
</where>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<select id="selectEmsStrategyRunningById" parameterType="Long" resultMap="EmsStrategyRunningResult">
|
|
|
|
|
<include refid="selectEmsStrategyRunningVo"/>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<insert id="insertEmsStrategyRunning" parameterType="EmsStrategyRunning" useGeneratedKeys="true" keyProperty="id">
|
|
|
|
|
insert into ems_strategy_running
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="mainStrategyId != null">main_strategy_id,</if>
|
|
|
|
|
<if test="auxiliaryStrategyId != null">auxiliary_strategy_id,</if>
|
|
|
|
|
<if test="status != null">status,</if>
|
|
|
|
|
<if test="createTime != null">create_time,</if>
|
|
|
|
|
<if test="updateTime != null">update_time,</if>
|
|
|
|
|
<if test="siteId != null">site_id,</if>
|
|
|
|
|
<if test="deviceId != null">device_id,</if>
|
|
|
|
|
<if test="remark != null">remark,</if>
|
|
|
|
|
</trim>
|
|
|
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
|
|
|
<if test="mainStrategyId != null">#{mainStrategyId},</if>
|
|
|
|
|
<if test="auxiliaryStrategyId != null">#{auxiliaryStrategyId},</if>
|
|
|
|
|
<if test="status != null">#{status},</if>
|
|
|
|
|
<if test="createTime != null">#{createTime},</if>
|
|
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
|
|
<if test="siteId != null">#{siteId},</if>
|
|
|
|
|
<if test="deviceId != null">#{deviceId},</if>
|
|
|
|
|
<if test="remark != null">#{remark},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
</insert>
|
|
|
|
|
|
|
|
|
|
<update id="updateEmsStrategyRunning" parameterType="EmsStrategyRunning">
|
|
|
|
|
update ems_strategy_running
|
|
|
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
|
|
|
<if test="mainStrategyId != null">main_strategy_id = #{mainStrategyId},</if>
|
|
|
|
|
<if test="auxiliaryStrategyId != null">auxiliary_strategy_id = #{auxiliaryStrategyId},</if>
|
|
|
|
|
<if test="status != null">status = #{status},</if>
|
|
|
|
|
<if test="createTime != null">create_time = #{createTime},</if>
|
|
|
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
|
|
|
|
<if test="siteId != null">site_id = #{siteId},</if>
|
|
|
|
|
<if test="deviceId != null">device_id = #{deviceId},</if>
|
|
|
|
|
<if test="remark != null">remark = #{remark},</if>
|
|
|
|
|
</trim>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteEmsStrategyRunningById" parameterType="Long">
|
|
|
|
|
delete from ems_strategy_running where id = #{id}
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<delete id="deleteEmsStrategyRunningByIds" parameterType="String">
|
|
|
|
|
delete from ems_strategy_running where id in
|
|
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
|
|
|
|
|
|
|
|
|
<select id="getRunningList" parameterType="String" resultType="com.xzzn.ems.domain.vo.StrategyRunningVo">
|
|
|
|
|
select t.id,
|
|
|
|
|
t.`status`,
|
|
|
|
|
t.site_id as siteId,
|
|
|
|
|
main.strategy_name as mainStrategyName,
|
|
|
|
|
aux.strategy_name as auxStrategyName
|
|
|
|
|
from ems_strategy_running t
|
|
|
|
|
LEFT JOIN ems_strategy main on t.main_strategy_id = main.id
|
|
|
|
|
LEFT JOIN ems_strategy aux on t.auxiliary_strategy_id = aux.id
|
|
|
|
|
where t.site_id = #{siteId}
|
|
|
|
|
and t.`status` != 4
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<update id="stopEmsStrategyRunning" parameterType="Long">
|
|
|
|
|
update ems_strategy_running set `status`= 4 where id = #{id}
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
<select id="selectEmsStrategyRunning" resultMap="EmsStrategyRunningResult">
|
|
|
|
|
<include refid="selectEmsStrategyRunningVo"/>
|
|
|
|
|
where site_id = #{siteId}
|
|
|
|
|
and main_strategy_id = #{mainStrategyId}
|
|
|
|
|
and auxiliary_strategy_id = #{auxiliaryStrategyId}
|
2025-07-12 18:51:23 +08:00
|
|
|
and `status` = 1
|
2025-07-10 22:30:56 +08:00
|
|
|
</select>
|
|
|
|
|
</mapper>
|