Browse Source

修正定时错误

master
xyiege 4 years ago
parent
commit
9b1a432440
  1. 4
      src/main/java/cn/chjyj/szwh/configure/QuartzConfig.java
  2. 2
      src/main/java/cn/chjyj/szwh/controller/QuartzController.java
  3. 4
      src/main/java/cn/chjyj/szwh/mapper/CronTriggerMapper.java
  4. 7
      src/main/java/cn/chjyj/szwh/mapper/TriggerMapper.java
  5. 8
      src/main/resources/application.properties
  6. 142
      src/main/resources/mapper/szwh/CronTriggerMapper.xml
  7. 40
      src/main/resources/mapper/szwh/JobDetailMapper.xml
  8. 374
      src/main/resources/mapper/szwh/TriggerMapper.xml
  9. 17
      src/main/resources/quartz.properties

4
src/main/java/cn/chjyj/szwh/configure/QuartzConfig.java

@ -54,6 +54,8 @@ public class QuartzConfig implements SchedulerFactoryBeanCustomizer {
@Override
public void customize(SchedulerFactoryBean schedulerFactoryBean) {
schedulerFactoryBean.setStartupDelay(2);
schedulerFactoryBean.setAutoStartup(true);
schedulerFactoryBean.setOverwriteExistingJobs(true);
}
}

2
src/main/java/cn/chjyj/szwh/controller/QuartzController.java

@ -161,7 +161,7 @@ public class QuartzController {
JSONObject jsonObject = new JSONObject();
PageInfo<JobAndTriggerDto> pageInfo = quartzService.getJobAndTriggerDetails(pageNum, pageSize);
Map<String, Object> map = new HashMap<>();
if (!StringUtils.isEmpty(pageInfo.getTotal())) {
if (pageInfo!=null) {
map.put("JobAndTrigger", pageInfo);
map.put("number", pageInfo.getTotal());
jsonObject.put("code",200);

4
src/main/java/cn/chjyj/szwh/mapper/CronTriggerMapper.java

@ -1,7 +1,7 @@
package cn.chjyj.szwh.mapper;
import org.example.pojo.CronTrigger;
import org.example.pojo.CronTriggerKey;
import cn.chjyj.szwh.bean.CronTrigger;
import cn.chjyj.szwh.bean.CronTriggerKey;
public interface CronTriggerMapper {
int deleteByPrimaryKey(CronTriggerKey key);

7
src/main/java/cn/chjyj/szwh/mapper/TriggerMapper.java

@ -1,8 +1,11 @@
package cn.chjyj.szwh.mapper;
import org.example.pojo.Trigger;
import org.example.pojo.TriggerKey;
import cn.chjyj.szwh.bean.Trigger;
import cn.chjyj.szwh.bean.TriggerKey;
import org.springframework.stereotype.Component;
@Component
public interface TriggerMapper {
int deleteByPrimaryKey(TriggerKey key);

8
src/main/resources/application.properties

@ -20,10 +20,8 @@ spring.redis.jedis.pool.max-active=8
spring.redis.jedis.pool.max-wait=-1
# 存放在数据库
spring.quartz.job-store-type=jdbc
#spring.quartz.job-store-type=jdbc
# 是否等待任务执行完毕后,容器才会关闭
spring.quartz.wait-for-jobs-to-complete-on-shutdown=true
#spring.quartz.wait-for-jobs-to-complete-on-shutdown=true
# 容器名称
spring.quartz.scheduler-name=SzwhScheduler
spring.quartz.properties=classpath:quatz.properties
spring.quartz
#spring.quartz.scheduler-name=SzwhScheduler

142
src/main/resources/mapper/szwh/CronTriggerMapper.xml

@ -1,88 +1,88 @@
<?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="org.example.mapper.CronTriggerMapper">
<resultMap id="BaseResultMap" type="org.example.pojo.CronTrigger">
<id column="SCHED_NAME" jdbcType="VARCHAR" property="schedName" />
<id column="TRIGGER_NAME" jdbcType="VARCHAR" property="triggerName" />
<id column="TRIGGER_GROUP" jdbcType="VARCHAR" property="triggerGroup" />
<result column="CRON_EXPRESSION" jdbcType="VARCHAR" property="cronExpression" />
<result column="TIME_ZONE_ID" jdbcType="VARCHAR" property="timeZoneId" />
</resultMap>
<sql id="Base_Column_List">
<mapper namespace="cn.chjyj.szwh.mapper.CronTriggerMapper">
<resultMap id="BaseResultMap" type="cn.chjyj.szwh.bean.CronTrigger">
<id column="SCHED_NAME" jdbcType="VARCHAR" property="schedName"/>
<id column="TRIGGER_NAME" jdbcType="VARCHAR" property="triggerName"/>
<id column="TRIGGER_GROUP" jdbcType="VARCHAR" property="triggerGroup"/>
<result column="CRON_EXPRESSION" jdbcType="VARCHAR" property="cronExpression"/>
<result column="TIME_ZONE_ID" jdbcType="VARCHAR" property="timeZoneId"/>
</resultMap>
<sql id="Base_Column_List">
SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP, CRON_EXPRESSION, TIME_ZONE_ID
</sql>
<select id="selectByPrimaryKey" parameterType="org.example.pojo.CronTriggerKey" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from qrtz_cron_triggers
where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR}
and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="org.example.pojo.CronTriggerKey">
<select id="selectByPrimaryKey" parameterType="cn.chjyj.szwh.bean.CronTriggerKey" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from qrtz_cron_triggers
where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR}
and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="cn.chjyj.szwh.bean.CronTriggerKey">
delete from qrtz_cron_triggers
where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR}
and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="org.example.pojo.CronTrigger">
<insert id="insert" parameterType="cn.chjyj.szwh.bean.CronTrigger">
insert into qrtz_cron_triggers (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP,
CRON_EXPRESSION, TIME_ZONE_ID)
values (#{schedName,jdbcType=VARCHAR}, #{triggerName,jdbcType=VARCHAR}, #{triggerGroup,jdbcType=VARCHAR},
#{cronExpression,jdbcType=VARCHAR}, #{timeZoneId,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="org.example.pojo.CronTrigger">
insert into qrtz_cron_triggers
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="schedName != null">
SCHED_NAME,
</if>
<if test="triggerName != null">
TRIGGER_NAME,
</if>
<if test="triggerGroup != null">
TRIGGER_GROUP,
</if>
<if test="cronExpression != null">
CRON_EXPRESSION,
</if>
<if test="timeZoneId != null">
TIME_ZONE_ID,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="schedName != null">
#{schedName,jdbcType=VARCHAR},
</if>
<if test="triggerName != null">
#{triggerName,jdbcType=VARCHAR},
</if>
<if test="triggerGroup != null">
#{triggerGroup,jdbcType=VARCHAR},
</if>
<if test="cronExpression != null">
#{cronExpression,jdbcType=VARCHAR},
</if>
<if test="timeZoneId != null">
#{timeZoneId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="org.example.pojo.CronTrigger">
update qrtz_cron_triggers
<set>
<if test="cronExpression != null">
CRON_EXPRESSION = #{cronExpression,jdbcType=VARCHAR},
</if>
<if test="timeZoneId != null">
TIME_ZONE_ID = #{timeZoneId,jdbcType=VARCHAR},
</if>
</set>
where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR}
and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="org.example.pojo.CronTrigger">
<insert id="insertSelective" parameterType="cn.chjyj.szwh.bean.CronTrigger">
insert into qrtz_cron_triggers
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="schedName != null">
SCHED_NAME,
</if>
<if test="triggerName != null">
TRIGGER_NAME,
</if>
<if test="triggerGroup != null">
TRIGGER_GROUP,
</if>
<if test="cronExpression != null">
CRON_EXPRESSION,
</if>
<if test="timeZoneId != null">
TIME_ZONE_ID,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="schedName != null">
#{schedName,jdbcType=VARCHAR},
</if>
<if test="triggerName != null">
#{triggerName,jdbcType=VARCHAR},
</if>
<if test="triggerGroup != null">
#{triggerGroup,jdbcType=VARCHAR},
</if>
<if test="cronExpression != null">
#{cronExpression,jdbcType=VARCHAR},
</if>
<if test="timeZoneId != null">
#{timeZoneId,jdbcType=VARCHAR},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.chjyj.szwh.bean.CronTrigger">
update qrtz_cron_triggers
<set>
<if test="cronExpression != null">
CRON_EXPRESSION = #{cronExpression,jdbcType=VARCHAR},
</if>
<if test="timeZoneId != null">
TIME_ZONE_ID = #{timeZoneId,jdbcType=VARCHAR},
</if>
</set>
where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR}
and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="cn.chjyj.szwh.bean.CronTrigger">
update qrtz_cron_triggers
set CRON_EXPRESSION = #{cronExpression,jdbcType=VARCHAR},
TIME_ZONE_ID = #{timeZoneId,jdbcType=VARCHAR}

40
src/main/resources/mapper/szwh/JobDetailMapper.xml

@ -1,7 +1,7 @@
<?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="org.example.mapper.JobDetailMapper">
<resultMap id="BaseResultMap" type="org.example.pojo.JobDetail">
<mapper namespace="cn.chjyj.szwh.mapper.JobDetailMapper">
<resultMap id="BaseResultMap" type="cn.chjyj.szwh.bean.JobDetail">
<id column="SCHED_NAME" jdbcType="VARCHAR" property="schedName"/>
<id column="JOB_NAME" jdbcType="VARCHAR" property="jobName"/>
<id column="JOB_GROUP" jdbcType="VARCHAR" property="jobGroup"/>
@ -12,7 +12,7 @@
<result column="IS_UPDATE_DATA" jdbcType="VARCHAR" property="isUpdateData"/>
<result column="REQUESTS_RECOVERY" jdbcType="VARCHAR" property="requestsRecovery"/>
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="org.example.pojo.JobDetail">
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="cn.chjyj.szwh.bean.JobDetail">
<result column="JOB_DATA" jdbcType="LONGVARBINARY" property="jobData"/>
</resultMap>
<sql id="Base_Column_List">
@ -24,7 +24,7 @@
JOB_DATA
</sql>
<select id="getJobAndTriggerDetails" resultType="org.example.dto.JobAndTriggerDto">
<select id="getJobAndTriggerDetails" resultType="cn.chjyj.szwh.bean.JobDetail">
SELECT DISTINCT
qrtz_job_details.JOB_NAME,
qrtz_job_details.JOB_GROUP,
@ -42,7 +42,7 @@
AND qrtz_triggers.TRIGGER_GROUP = qrtz_cron_triggers.TRIGGER_GROUP
</select>
<select id="selectByPrimaryKey" parameterType="org.example.pojo.JobDetailKey" resultMap="ResultMapWithBLOBs">
<select id="selectByPrimaryKey" parameterType="cn.chjyj.szwh.bean.JobDetailKey" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List"/>
,
@ -52,25 +52,33 @@
and JOB_NAME = #{jobName,jdbcType=VARCHAR}
and JOB_GROUP = #{jobGroup,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="org.example.pojo.JobDetailKey">
<delete id="deleteByPrimaryKey" parameterType="cn.chjyj.szwh.bean.JobDetailKey">
delete
from qrtz_job_details
where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
and JOB_NAME = #{jobName,jdbcType=VARCHAR}
and JOB_GROUP = #{jobGroup,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="org.example.pojo.JobDetail">
<insert id="insert" parameterType="cn.chjyj.szwh.bean.JobDetail">
insert into qrtz_job_details (SCHED_NAME, JOB_NAME, JOB_GROUP,
DESCRIPTION, JOB_CLASS_NAME, IS_DURABLE,
IS_NONCONCURRENT, IS_UPDATE_DATA, REQUESTS_RECOVERY,
IS_NONCONCURRENT,
IS_UPDATE_DATA,
REQUESTS_RECOVERY,
JOB_DATA)
values (#{schedName,jdbcType=VARCHAR}, #{jobName,jdbcType=VARCHAR}, #{jobGroup,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR}, #{jobClassName,jdbcType=VARCHAR}, #{isDurable,jdbcType=VARCHAR},
#{isNonconcurrent,jdbcType=VARCHAR}, #{isUpdateData,jdbcType=VARCHAR},
values (#{schedName,jdbcType=VARCHAR}, #{jobName,jdbcType=VARCHAR},
#{jobGroup,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR}, #{jobClassName,jdbcType=VARCHAR},
#{isDurable,jdbcType=VARCHAR},
#{isNonconcurrent,jdbcType=VARCHAR},
#{isUpdateData,jdbcType=VARCHAR},
#{requestsRecovery,jdbcType=VARCHAR},
#{jobData,jdbcType=LONGVARBINARY})
</insert>
<insert id="insertSelective" parameterType="org.example.pojo.JobDetail">
<insert id="insertSelective" parameterType="cn.chjyj.szwh.bean.JobDetail">
insert into qrtz_job_details
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="schedName != null">
@ -137,7 +145,7 @@
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="org.example.pojo.JobDetail">
<update id="updateByPrimaryKeySelective" parameterType="cn.chjyj.szwh.bean.JobDetail">
update qrtz_job_details
<set>
<if test="description != null">
@ -166,7 +174,8 @@
and JOB_NAME = #{jobName,jdbcType=VARCHAR}
and JOB_GROUP = #{jobGroup,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="org.example.pojo.JobDetail">
<update id="updateByPrimaryKeyWithBLOBs" parameterType="cn.chjyj.szwh.bean.JobDetail">
update qrtz_job_details
set DESCRIPTION = #{description,jdbcType=VARCHAR},
JOB_CLASS_NAME = #{jobClassName,jdbcType=VARCHAR},
@ -179,7 +188,8 @@
and JOB_NAME = #{jobName,jdbcType=VARCHAR}
and JOB_GROUP = #{jobGroup,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="org.example.pojo.JobDetail">
<update id="updateByPrimaryKey" parameterType="cn.chjyj.szwh.bean.JobDetail">
update qrtz_job_details
set DESCRIPTION = #{description,jdbcType=VARCHAR},
JOB_CLASS_NAME = #{jobClassName,jdbcType=VARCHAR},

374
src/main/resources/mapper/szwh/TriggerMapper.xml

@ -1,51 +1,51 @@
<?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="org.example.mapper.TriggerMapper">
<resultMap id="BaseResultMap" type="org.example.pojo.Trigger">
<id column="SCHED_NAME" jdbcType="VARCHAR" property="schedName" />
<id column="TRIGGER_NAME" jdbcType="VARCHAR" property="triggerName" />
<id column="TRIGGER_GROUP" jdbcType="VARCHAR" property="triggerGroup" />
<result column="JOB_NAME" jdbcType="VARCHAR" property="jobName" />
<result column="JOB_GROUP" jdbcType="VARCHAR" property="jobGroup" />
<result column="DESCRIPTION" jdbcType="VARCHAR" property="description" />
<result column="NEXT_FIRE_TIME" jdbcType="BIGINT" property="nextFireTime" />
<result column="PREV_FIRE_TIME" jdbcType="BIGINT" property="prevFireTime" />
<result column="PRIORITY" jdbcType="INTEGER" property="priority" />
<result column="TRIGGER_STATE" jdbcType="VARCHAR" property="triggerState" />
<result column="TRIGGER_TYPE" jdbcType="VARCHAR" property="triggerType" />
<result column="START_TIME" jdbcType="BIGINT" property="startTime" />
<result column="END_TIME" jdbcType="BIGINT" property="endTime" />
<result column="CALENDAR_NAME" jdbcType="VARCHAR" property="calendarName" />
<result column="MISFIRE_INSTR" jdbcType="SMALLINT" property="misfireInstr" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="org.example.pojo.Trigger">
<result column="JOB_DATA" jdbcType="LONGVARBINARY" property="jobData" />
</resultMap>
<sql id="Base_Column_List">
<mapper namespace="cn.chjyj.szwh.mapper.TriggerMapper">
<resultMap id="BaseResultMap" type="cn.chjyj.szwh.bean.Trigger">
<id column="SCHED_NAME" jdbcType="VARCHAR" property="schedName"/>
<id column="TRIGGER_NAME" jdbcType="VARCHAR" property="triggerName"/>
<id column="TRIGGER_GROUP" jdbcType="VARCHAR" property="triggerGroup"/>
<result column="JOB_NAME" jdbcType="VARCHAR" property="jobName"/>
<result column="JOB_GROUP" jdbcType="VARCHAR" property="jobGroup"/>
<result column="DESCRIPTION" jdbcType="VARCHAR" property="description"/>
<result column="NEXT_FIRE_TIME" jdbcType="BIGINT" property="nextFireTime"/>
<result column="PREV_FIRE_TIME" jdbcType="BIGINT" property="prevFireTime"/>
<result column="PRIORITY" jdbcType="INTEGER" property="priority"/>
<result column="TRIGGER_STATE" jdbcType="VARCHAR" property="triggerState"/>
<result column="TRIGGER_TYPE" jdbcType="VARCHAR" property="triggerType"/>
<result column="START_TIME" jdbcType="BIGINT" property="startTime"/>
<result column="END_TIME" jdbcType="BIGINT" property="endTime"/>
<result column="CALENDAR_NAME" jdbcType="VARCHAR" property="calendarName"/>
<result column="MISFIRE_INSTR" jdbcType="SMALLINT" property="misfireInstr"/>
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="cn.chjyj.szwh.bean.Trigger">
<result column="JOB_DATA" jdbcType="LONGVARBINARY" property="jobData"/>
</resultMap>
<sql id="Base_Column_List">
SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP, JOB_NAME, JOB_GROUP, DESCRIPTION, NEXT_FIRE_TIME,
PREV_FIRE_TIME, PRIORITY, TRIGGER_STATE, TRIGGER_TYPE, START_TIME, END_TIME, CALENDAR_NAME,
MISFIRE_INSTR
</sql>
<sql id="Blob_Column_List">
<sql id="Blob_Column_List">
JOB_DATA
</sql>
<select id="selectByPrimaryKey" parameterType="org.example.pojo.TriggerKey" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from qrtz_triggers
where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR}
and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="org.example.pojo.TriggerKey">
<select id="selectByPrimaryKey" parameterType="cn.chjyj.szwh.bean.TriggerKey" resultMap="ResultMapWithBLOBs">
select
<include refid="Base_Column_List"/>
,
<include refid="Blob_Column_List"/>
from qrtz_triggers
where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR}
and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="cn.chjyj.szwh.bean.TriggerKey">
delete from qrtz_triggers
where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR}
and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="org.example.pojo.Trigger">
<insert id="insert" parameterType="cn.chjyj.szwh.bean.Trigger">
insert into qrtz_triggers (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP,
JOB_NAME, JOB_GROUP, DESCRIPTION,
NEXT_FIRE_TIME, PREV_FIRE_TIME, PRIORITY,
@ -59,157 +59,157 @@
#{endTime,jdbcType=BIGINT}, #{calendarName,jdbcType=VARCHAR}, #{misfireInstr,jdbcType=SMALLINT},
#{jobData,jdbcType=LONGVARBINARY})
</insert>
<insert id="insertSelective" parameterType="org.example.pojo.Trigger">
insert into qrtz_triggers
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="schedName != null">
SCHED_NAME,
</if>
<if test="triggerName != null">
TRIGGER_NAME,
</if>
<if test="triggerGroup != null">
TRIGGER_GROUP,
</if>
<if test="jobName != null">
JOB_NAME,
</if>
<if test="jobGroup != null">
JOB_GROUP,
</if>
<if test="description != null">
DESCRIPTION,
</if>
<if test="nextFireTime != null">
NEXT_FIRE_TIME,
</if>
<if test="prevFireTime != null">
PREV_FIRE_TIME,
</if>
<if test="priority != null">
PRIORITY,
</if>
<if test="triggerState != null">
TRIGGER_STATE,
</if>
<if test="triggerType != null">
TRIGGER_TYPE,
</if>
<if test="startTime != null">
START_TIME,
</if>
<if test="endTime != null">
END_TIME,
</if>
<if test="calendarName != null">
CALENDAR_NAME,
</if>
<if test="misfireInstr != null">
MISFIRE_INSTR,
</if>
<if test="jobData != null">
JOB_DATA,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="schedName != null">
#{schedName,jdbcType=VARCHAR},
</if>
<if test="triggerName != null">
#{triggerName,jdbcType=VARCHAR},
</if>
<if test="triggerGroup != null">
#{triggerGroup,jdbcType=VARCHAR},
</if>
<if test="jobName != null">
#{jobName,jdbcType=VARCHAR},
</if>
<if test="jobGroup != null">
#{jobGroup,jdbcType=VARCHAR},
</if>
<if test="description != null">
#{description,jdbcType=VARCHAR},
</if>
<if test="nextFireTime != null">
#{nextFireTime,jdbcType=BIGINT},
</if>
<if test="prevFireTime != null">
#{prevFireTime,jdbcType=BIGINT},
</if>
<if test="priority != null">
#{priority,jdbcType=INTEGER},
</if>
<if test="triggerState != null">
#{triggerState,jdbcType=VARCHAR},
</if>
<if test="triggerType != null">
#{triggerType,jdbcType=VARCHAR},
</if>
<if test="startTime != null">
#{startTime,jdbcType=BIGINT},
</if>
<if test="endTime != null">
#{endTime,jdbcType=BIGINT},
</if>
<if test="calendarName != null">
#{calendarName,jdbcType=VARCHAR},
</if>
<if test="misfireInstr != null">
#{misfireInstr,jdbcType=SMALLINT},
</if>
<if test="jobData != null">
#{jobData,jdbcType=LONGVARBINARY},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="org.example.pojo.Trigger">
update qrtz_triggers
<set>
<if test="jobName != null">
JOB_NAME = #{jobName,jdbcType=VARCHAR},
</if>
<if test="jobGroup != null">
JOB_GROUP = #{jobGroup,jdbcType=VARCHAR},
</if>
<if test="description != null">
DESCRIPTION = #{description,jdbcType=VARCHAR},
</if>
<if test="nextFireTime != null">
NEXT_FIRE_TIME = #{nextFireTime,jdbcType=BIGINT},
</if>
<if test="prevFireTime != null">
PREV_FIRE_TIME = #{prevFireTime,jdbcType=BIGINT},
</if>
<if test="priority != null">
PRIORITY = #{priority,jdbcType=INTEGER},
</if>
<if test="triggerState != null">
TRIGGER_STATE = #{triggerState,jdbcType=VARCHAR},
</if>
<if test="triggerType != null">
TRIGGER_TYPE = #{triggerType,jdbcType=VARCHAR},
</if>
<if test="startTime != null">
START_TIME = #{startTime,jdbcType=BIGINT},
</if>
<if test="endTime != null">
END_TIME = #{endTime,jdbcType=BIGINT},
</if>
<if test="calendarName != null">
CALENDAR_NAME = #{calendarName,jdbcType=VARCHAR},
</if>
<if test="misfireInstr != null">
MISFIRE_INSTR = #{misfireInstr,jdbcType=SMALLINT},
</if>
<if test="jobData != null">
JOB_DATA = #{jobData,jdbcType=LONGVARBINARY},
</if>
</set>
where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR}
and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="org.example.pojo.Trigger">
<insert id="insertSelective" parameterType="cn.chjyj.szwh.bean.Trigger">
insert into qrtz_triggers
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="schedName != null">
SCHED_NAME,
</if>
<if test="triggerName != null">
TRIGGER_NAME,
</if>
<if test="triggerGroup != null">
TRIGGER_GROUP,
</if>
<if test="jobName != null">
JOB_NAME,
</if>
<if test="jobGroup != null">
JOB_GROUP,
</if>
<if test="description != null">
DESCRIPTION,
</if>
<if test="nextFireTime != null">
NEXT_FIRE_TIME,
</if>
<if test="prevFireTime != null">
PREV_FIRE_TIME,
</if>
<if test="priority != null">
PRIORITY,
</if>
<if test="triggerState != null">
TRIGGER_STATE,
</if>
<if test="triggerType != null">
TRIGGER_TYPE,
</if>
<if test="startTime != null">
START_TIME,
</if>
<if test="endTime != null">
END_TIME,
</if>
<if test="calendarName != null">
CALENDAR_NAME,
</if>
<if test="misfireInstr != null">
MISFIRE_INSTR,
</if>
<if test="jobData != null">
JOB_DATA,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="schedName != null">
#{schedName,jdbcType=VARCHAR},
</if>
<if test="triggerName != null">
#{triggerName,jdbcType=VARCHAR},
</if>
<if test="triggerGroup != null">
#{triggerGroup,jdbcType=VARCHAR},
</if>
<if test="jobName != null">
#{jobName,jdbcType=VARCHAR},
</if>
<if test="jobGroup != null">
#{jobGroup,jdbcType=VARCHAR},
</if>
<if test="description != null">
#{description,jdbcType=VARCHAR},
</if>
<if test="nextFireTime != null">
#{nextFireTime,jdbcType=BIGINT},
</if>
<if test="prevFireTime != null">
#{prevFireTime,jdbcType=BIGINT},
</if>
<if test="priority != null">
#{priority,jdbcType=INTEGER},
</if>
<if test="triggerState != null">
#{triggerState,jdbcType=VARCHAR},
</if>
<if test="triggerType != null">
#{triggerType,jdbcType=VARCHAR},
</if>
<if test="startTime != null">
#{startTime,jdbcType=BIGINT},
</if>
<if test="endTime != null">
#{endTime,jdbcType=BIGINT},
</if>
<if test="calendarName != null">
#{calendarName,jdbcType=VARCHAR},
</if>
<if test="misfireInstr != null">
#{misfireInstr,jdbcType=SMALLINT},
</if>
<if test="jobData != null">
#{jobData,jdbcType=LONGVARBINARY},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="cn.chjyj.szwh.bean.Trigger">
update qrtz_triggers
<set>
<if test="jobName != null">
JOB_NAME = #{jobName,jdbcType=VARCHAR},
</if>
<if test="jobGroup != null">
JOB_GROUP = #{jobGroup,jdbcType=VARCHAR},
</if>
<if test="description != null">
DESCRIPTION = #{description,jdbcType=VARCHAR},
</if>
<if test="nextFireTime != null">
NEXT_FIRE_TIME = #{nextFireTime,jdbcType=BIGINT},
</if>
<if test="prevFireTime != null">
PREV_FIRE_TIME = #{prevFireTime,jdbcType=BIGINT},
</if>
<if test="priority != null">
PRIORITY = #{priority,jdbcType=INTEGER},
</if>
<if test="triggerState != null">
TRIGGER_STATE = #{triggerState,jdbcType=VARCHAR},
</if>
<if test="triggerType != null">
TRIGGER_TYPE = #{triggerType,jdbcType=VARCHAR},
</if>
<if test="startTime != null">
START_TIME = #{startTime,jdbcType=BIGINT},
</if>
<if test="endTime != null">
END_TIME = #{endTime,jdbcType=BIGINT},
</if>
<if test="calendarName != null">
CALENDAR_NAME = #{calendarName,jdbcType=VARCHAR},
</if>
<if test="misfireInstr != null">
MISFIRE_INSTR = #{misfireInstr,jdbcType=SMALLINT},
</if>
<if test="jobData != null">
JOB_DATA = #{jobData,jdbcType=LONGVARBINARY},
</if>
</set>
where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR}
and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="cn.chjyj.szwh.bean.Trigger">
update qrtz_triggers
set JOB_NAME = #{jobName,jdbcType=VARCHAR},
JOB_GROUP = #{jobGroup,jdbcType=VARCHAR},
@ -228,7 +228,7 @@
and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR}
and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="org.example.pojo.Trigger">
<update id="updateByPrimaryKey" parameterType="cn.chjyj.szwh.bean.Trigger">
update qrtz_triggers
set JOB_NAME = #{jobName,jdbcType=VARCHAR},
JOB_GROUP = #{jobGroup,jdbcType=VARCHAR},

17
src/main/resources/quartz.properties

@ -2,7 +2,7 @@
org.quartz.scheduler.instanceId=AUTO
org.quartz.scheduler.instanceName=DefaultQuartzScheduler
org.quartz.scheduler.instanceName=SzwhScheduler
#如果您希望Quartz Scheduler通过RMI作为服务器导出本身,则将“rmi.export”标志设置为true
#在同一个配置文件中为'org.quartz.scheduler.rmi.export'和'org.quartz.scheduler.rmi.proxy'指定一个'true'值是没有意义的,如果你这样做'export'选项将被忽略
org.quartz.scheduler.rmi.export=false
@ -39,15 +39,16 @@ org.quartz.jobStore.useProperties=true
#表前缀
org.quartz.jobStore.tablePrefix=QRTZ_
#数据源别名,自定义
org.quartz.jobStore.dataSource=qzDS
org.quartz.jobStore.dataSource=datasoure
#org.quartz.jobStore.dataSource=qzDS
#使用阿里的druid作为数据库连接池
org.quartz.dataSource.qzDS.connectionProvider.class=org.example.config.DruidPoolingconnectionProvider
org.quartz.dataSource.qzDS.URL=jdbc:mysql://127.0.0.1:3306/test_quartz?characterEncoding=utf8&useSSL=false&autoReconnect=true&serverTimezone=UTC
org.quartz.dataSource.qzDS.user=root
org.quartz.dataSource.qzDS.password=123456
org.quartz.dataSource.qzDS.driver=com.mysql.jdbc.Driver
org.quartz.dataSource.qzDS.maxConnections=10
#org.quartz.dataSource.qzDS.connectionProvider.class=org.example.config.DruidPoolingconnectionProvider
#org.quartz.dataSource.qzDS.URL=jdbc:mysql://127.0.0.1:3306/test_quartz?characterEncoding=utf8&useSSL=false&autoReconnect=true&serverTimezone=UTC
#org.quartz.dataSource.qzDS.user=root
#org.quartz.dataSource.qzDS.password=123456
#org.quartz.dataSource.qzDS.driver=com.mysql.jdbc.Driver
#org.quartz.dataSource.qzDS.maxConnections=10
#设置为“true”以打开群集功能。如果您有多个Quartz实例使用同一组数据库表,则此属性必须设置为“true”,否则您将遇到破坏
#org.quartz.jobStore.isClustered=false

Loading…
Cancel
Save