mx_datav_gs/mxdata_v-system/target/classes/mybatis/business/MxQuartzMapper.xml

90 lines
3.4 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.alonginfo.project.business.mapper.MxQuartzMapper">
<sql id="baseColumn">
job_id jobId, job_name jobName, job_group jobGroup, invoke_target invokeTarget, cron_expression cronExpression,
misfire_policy misfirePolicy, concurrent, status, create_by createBy, DATe_FORMAT(create_time, '%Y-%m-%d %H:%i:%s') createTime,
update_by updateBy, DATe_FORMAT(update_time, '%Y-%m-%d %H:%i:%s') updateTime, remark
</sql>
<!--查询所有定时任务-->
<select id="getQuartzList" resultType="java.util.Map">
SELECT
<include refid="baseColumn"></include>
FROM
sys_job
<where>
<if test="jobName != null and jobName != ''">
AND job_name LIKE CONCAT('%', #{jobName}, '%')
</if>
<if test="jobGroup != null and jobGroup != ''">
AND job_group = #{jobGroup}
</if>
<if test="invokeTarget != null and invokeTarget != ''">
AND invoke_target LIKE CONCAT('%', #{invokeTarget}, '%')
</if>
<if test="status !=null and status != ''">
AND status = #{status}
</if>
</where>
</select>
<!--通过id查询定时任务详细信息-->
<select id="selectJobById" resultType="com.alonginfo.quartz.domain.SysJob">
SELECT
<include refid="baseColumn"></include>
FROM
sys_job
WHERE
job_id = #{jobId}
</select>
<!--更新定时任务-->
<update id="updateJob">
UPDATE sys_job
<set>
<if test="jobName != null and jobName != ''">
job_name = #{jobName},
</if>
<if test="jobGroup != null and jobGroup != ''">
job_group = #{jobGroup},
</if>
<if test="invokeTarget != null and invokeTarget != ''">
invoke_target = #{invokeTarget},
</if>
<if test="cronExpression != null and cronExpression != ''">
cron_expression = #{cronExpression},
</if>
<if test="misfirePolicy != null and misfirePolicy != ''">
misfire_policy = #{misfirePolicy},
</if>
<if test="concurrent != null and concurrent != ''">
concurrent = #{concurrent},
</if>
<if test="status !=null">
status = #{status},
</if>
<if test="remark != null and remark != ''">
remark = #{remark},
</if>
<if test="updateBy != null and updateBy != ''">
update_by = #{updateBy},
</if>
update_time = now()
</set>
WHERE job_id = #{jobId}
</update>
<!--新增定时任务-->
<insert id="insertJob" useGeneratedKeys="true" keyProperty="jobId">
INSERT INTO sys_job
(job_id, job_name, job_group, invoke_target, cron_expression, misfire_policy, concurrent,
status, create_by, create_time, update_by, update_time)
VALUES
(null, #{jobName}, #{jobGroup}, #{invokeTarget}, #{cronExpression}, #{misfirePolicy}, #{concurrent},
#{status}, #{createBy}, now(), #{updateBy}, #{updateTime})
</insert>
</mapper>