118 lines
3.8 KiB
XML
118 lines
3.8 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.zhangy.skyeye.jm.mapper.JmJobMapper">
|
|
<sql id="selectSql">
|
|
select
|
|
j.id,
|
|
j.id as conf_id,
|
|
j.name,
|
|
j.status,
|
|
j.mode,
|
|
j.begin_time,
|
|
j.end_time,
|
|
j.create_time,
|
|
j.type,
|
|
j.cron_expression
|
|
from jm_job j
|
|
</sql>
|
|
|
|
<select id="selectPage" resultType="com.zhangy.skyeye.jm.dto.JmJobDTO">
|
|
<include refid="selectSql"/>
|
|
where 1 = 1
|
|
<if test="type != null and type == 1">
|
|
and j.status in ('1', '3')
|
|
</if>
|
|
<if test="uavId != null">
|
|
and exists (select 1 from jm_job_uav ju where j.id = ju.job_id and ju.uav_id = #{uavId})
|
|
</if>
|
|
<if test="payloadId != null">
|
|
and exists (select 1 from jm_job_payload jp where j.id = jp.job_id and jp.payload_id = #{payloadId})
|
|
</if>
|
|
</select>
|
|
|
|
<select id="selectList" resultType="com.zhangy.skyeye.jm.dto.JmJobDTO">
|
|
<include refid="selectSql"/>
|
|
where 1 = 1
|
|
<if test="type != null and type == 1">
|
|
and j.status in ('1', '3')
|
|
</if>
|
|
<if test="uavId != null">
|
|
and exists (select 1 from jm_job_uav ju where j.id = ju.job_id and ju.uav_id = #{uavId})
|
|
</if>
|
|
<if test="payloadId != null">
|
|
and exists (select 1 from jm_job_payload jp where j.id = jp.job_id and jp.payload_id = #{payloadId})
|
|
</if>
|
|
order by j.create_time desc
|
|
</select>
|
|
|
|
<select id="selectById" resultType="com.zhangy.skyeye.jm.dto.JmJobDTO">
|
|
<include refid="selectSql"/>
|
|
where j.id in
|
|
<foreach item="item" collection="array" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</select>
|
|
|
|
<insert id="insert" useGeneratedKeys="true" keyProperty="id">
|
|
insert into jm_job(
|
|
id,
|
|
name,
|
|
mode,
|
|
status,
|
|
begin_time,
|
|
end_time,
|
|
create_time,
|
|
type,
|
|
cron_expression
|
|
) values
|
|
<foreach item="item" index="index" collection="array" separator=",">
|
|
(
|
|
#{item.id},
|
|
#{item.name},
|
|
#{item.mode},
|
|
#{item.status},
|
|
#{item.beginTime},
|
|
#{item.endTime},
|
|
#{item.createTime},
|
|
#{item.type},
|
|
#{item.cronExpression}
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
|
|
<update id="updateNotNull">
|
|
update jm_job
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="name != null">name = #{name},</if>
|
|
<if test="status != null">status = #{status},</if>
|
|
<if test="mode != null">mode = #{mode},</if>
|
|
<if test="beginTime != null">begin_time = #{beginTime},</if>
|
|
<if test="endTime != null">end_time = #{endTime},</if>
|
|
<if test="type != null">type = #{type},</if>
|
|
<if test="cronExpression != null and cronExpression != ''">cron_expression = #{cronExpression},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<update id="update">
|
|
update jm_job
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
name = #{name},
|
|
status = #{status},
|
|
mode = #{mode},
|
|
begin_time = #{beginTime},
|
|
end_time = #{endTime},
|
|
type = #{type},
|
|
cron_expression = #{cronExpression},
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="delete">
|
|
delete from jm_job where id in
|
|
<foreach item="item" collection="array" open="(" separator="," close=")">
|
|
#{item}
|
|
</foreach>
|
|
</delete>
|
|
</mapper> |