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 @Override
public void customize(SchedulerFactoryBean schedulerFactoryBean) { 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(); JSONObject jsonObject = new JSONObject();
PageInfo<JobAndTriggerDto> pageInfo = quartzService.getJobAndTriggerDetails(pageNum, pageSize); PageInfo<JobAndTriggerDto> pageInfo = quartzService.getJobAndTriggerDetails(pageNum, pageSize);
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
if (!StringUtils.isEmpty(pageInfo.getTotal())) { if (pageInfo!=null) {
map.put("JobAndTrigger", pageInfo); map.put("JobAndTrigger", pageInfo);
map.put("number", pageInfo.getTotal()); map.put("number", pageInfo.getTotal());
jsonObject.put("code",200); jsonObject.put("code",200);

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

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

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

@ -1,8 +1,11 @@
package cn.chjyj.szwh.mapper; 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 { public interface TriggerMapper {
int deleteByPrimaryKey(TriggerKey key); 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.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.scheduler-name=SzwhScheduler
spring.quartz.properties=classpath:quatz.properties
spring.quartz

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

@ -1,88 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.example.mapper.CronTriggerMapper"> <mapper namespace="cn.chjyj.szwh.mapper.CronTriggerMapper">
<resultMap id="BaseResultMap" type="org.example.pojo.CronTrigger"> <resultMap id="BaseResultMap" type="cn.chjyj.szwh.bean.CronTrigger">
<id column="SCHED_NAME" jdbcType="VARCHAR" property="schedName" /> <id column="SCHED_NAME" jdbcType="VARCHAR" property="schedName"/>
<id column="TRIGGER_NAME" jdbcType="VARCHAR" property="triggerName" /> <id column="TRIGGER_NAME" jdbcType="VARCHAR" property="triggerName"/>
<id column="TRIGGER_GROUP" jdbcType="VARCHAR" property="triggerGroup" /> <id column="TRIGGER_GROUP" jdbcType="VARCHAR" property="triggerGroup"/>
<result column="CRON_EXPRESSION" jdbcType="VARCHAR" property="cronExpression" /> <result column="CRON_EXPRESSION" jdbcType="VARCHAR" property="cronExpression"/>
<result column="TIME_ZONE_ID" jdbcType="VARCHAR" property="timeZoneId" /> <result column="TIME_ZONE_ID" jdbcType="VARCHAR" property="timeZoneId"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP, CRON_EXPRESSION, TIME_ZONE_ID SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP, CRON_EXPRESSION, TIME_ZONE_ID
</sql> </sql>
<select id="selectByPrimaryKey" parameterType="org.example.pojo.CronTriggerKey" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="cn.chjyj.szwh.bean.CronTriggerKey" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List"/>
from qrtz_cron_triggers from qrtz_cron_triggers
where SCHED_NAME = #{schedName,jdbcType=VARCHAR} where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR} and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR}
and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR} and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="org.example.pojo.CronTriggerKey"> <delete id="deleteByPrimaryKey" parameterType="cn.chjyj.szwh.bean.CronTriggerKey">
delete from qrtz_cron_triggers delete from qrtz_cron_triggers
where SCHED_NAME = #{schedName,jdbcType=VARCHAR} where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR} and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR}
and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR} and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR}
</delete> </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, insert into qrtz_cron_triggers (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP,
CRON_EXPRESSION, TIME_ZONE_ID) CRON_EXPRESSION, TIME_ZONE_ID)
values (#{schedName,jdbcType=VARCHAR}, #{triggerName,jdbcType=VARCHAR}, #{triggerGroup,jdbcType=VARCHAR}, values (#{schedName,jdbcType=VARCHAR}, #{triggerName,jdbcType=VARCHAR}, #{triggerGroup,jdbcType=VARCHAR},
#{cronExpression,jdbcType=VARCHAR}, #{timeZoneId,jdbcType=VARCHAR}) #{cronExpression,jdbcType=VARCHAR}, #{timeZoneId,jdbcType=VARCHAR})
</insert> </insert>
<insert id="insertSelective" parameterType="org.example.pojo.CronTrigger"> <insert id="insertSelective" parameterType="cn.chjyj.szwh.bean.CronTrigger">
insert into qrtz_cron_triggers insert into qrtz_cron_triggers
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="schedName != null"> <if test="schedName != null">
SCHED_NAME, SCHED_NAME,
</if> </if>
<if test="triggerName != null"> <if test="triggerName != null">
TRIGGER_NAME, TRIGGER_NAME,
</if> </if>
<if test="triggerGroup != null"> <if test="triggerGroup != null">
TRIGGER_GROUP, TRIGGER_GROUP,
</if> </if>
<if test="cronExpression != null"> <if test="cronExpression != null">
CRON_EXPRESSION, CRON_EXPRESSION,
</if> </if>
<if test="timeZoneId != null"> <if test="timeZoneId != null">
TIME_ZONE_ID, TIME_ZONE_ID,
</if> </if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="schedName != null"> <if test="schedName != null">
#{schedName,jdbcType=VARCHAR}, #{schedName,jdbcType=VARCHAR},
</if> </if>
<if test="triggerName != null"> <if test="triggerName != null">
#{triggerName,jdbcType=VARCHAR}, #{triggerName,jdbcType=VARCHAR},
</if> </if>
<if test="triggerGroup != null"> <if test="triggerGroup != null">
#{triggerGroup,jdbcType=VARCHAR}, #{triggerGroup,jdbcType=VARCHAR},
</if> </if>
<if test="cronExpression != null"> <if test="cronExpression != null">
#{cronExpression,jdbcType=VARCHAR}, #{cronExpression,jdbcType=VARCHAR},
</if> </if>
<if test="timeZoneId != null"> <if test="timeZoneId != null">
#{timeZoneId,jdbcType=VARCHAR}, #{timeZoneId,jdbcType=VARCHAR},
</if> </if>
</trim> </trim>
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="org.example.pojo.CronTrigger"> <update id="updateByPrimaryKeySelective" parameterType="cn.chjyj.szwh.bean.CronTrigger">
update qrtz_cron_triggers update qrtz_cron_triggers
<set> <set>
<if test="cronExpression != null"> <if test="cronExpression != null">
CRON_EXPRESSION = #{cronExpression,jdbcType=VARCHAR}, CRON_EXPRESSION = #{cronExpression,jdbcType=VARCHAR},
</if> </if>
<if test="timeZoneId != null"> <if test="timeZoneId != null">
TIME_ZONE_ID = #{timeZoneId,jdbcType=VARCHAR}, TIME_ZONE_ID = #{timeZoneId,jdbcType=VARCHAR},
</if> </if>
</set> </set>
where SCHED_NAME = #{schedName,jdbcType=VARCHAR} where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR} and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR}
and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR} and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR}
</update> </update>
<update id="updateByPrimaryKey" parameterType="org.example.pojo.CronTrigger"> <update id="updateByPrimaryKey" parameterType="cn.chjyj.szwh.bean.CronTrigger">
update qrtz_cron_triggers update qrtz_cron_triggers
set CRON_EXPRESSION = #{cronExpression,jdbcType=VARCHAR}, set CRON_EXPRESSION = #{cronExpression,jdbcType=VARCHAR},
TIME_ZONE_ID = #{timeZoneId,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"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.example.mapper.JobDetailMapper"> <mapper namespace="cn.chjyj.szwh.mapper.JobDetailMapper">
<resultMap id="BaseResultMap" type="org.example.pojo.JobDetail"> <resultMap id="BaseResultMap" type="cn.chjyj.szwh.bean.JobDetail">
<id column="SCHED_NAME" jdbcType="VARCHAR" property="schedName"/> <id column="SCHED_NAME" jdbcType="VARCHAR" property="schedName"/>
<id column="JOB_NAME" jdbcType="VARCHAR" property="jobName"/> <id column="JOB_NAME" jdbcType="VARCHAR" property="jobName"/>
<id column="JOB_GROUP" jdbcType="VARCHAR" property="jobGroup"/> <id column="JOB_GROUP" jdbcType="VARCHAR" property="jobGroup"/>
@ -12,7 +12,7 @@
<result column="IS_UPDATE_DATA" jdbcType="VARCHAR" property="isUpdateData"/> <result column="IS_UPDATE_DATA" jdbcType="VARCHAR" property="isUpdateData"/>
<result column="REQUESTS_RECOVERY" jdbcType="VARCHAR" property="requestsRecovery"/> <result column="REQUESTS_RECOVERY" jdbcType="VARCHAR" property="requestsRecovery"/>
</resultMap> </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"/> <result column="JOB_DATA" jdbcType="LONGVARBINARY" property="jobData"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
@ -24,7 +24,7 @@
JOB_DATA JOB_DATA
</sql> </sql>
<select id="getJobAndTriggerDetails" resultType="org.example.dto.JobAndTriggerDto"> <select id="getJobAndTriggerDetails" resultType="cn.chjyj.szwh.bean.JobDetail">
SELECT DISTINCT SELECT DISTINCT
qrtz_job_details.JOB_NAME, qrtz_job_details.JOB_NAME,
qrtz_job_details.JOB_GROUP, qrtz_job_details.JOB_GROUP,
@ -42,7 +42,7 @@
AND qrtz_triggers.TRIGGER_GROUP = qrtz_cron_triggers.TRIGGER_GROUP AND qrtz_triggers.TRIGGER_GROUP = qrtz_cron_triggers.TRIGGER_GROUP
</select> </select>
<select id="selectByPrimaryKey" parameterType="org.example.pojo.JobDetailKey" resultMap="ResultMapWithBLOBs"> <select id="selectByPrimaryKey" parameterType="cn.chjyj.szwh.bean.JobDetailKey" resultMap="ResultMapWithBLOBs">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
, ,
@ -52,25 +52,33 @@
and JOB_NAME = #{jobName,jdbcType=VARCHAR} and JOB_NAME = #{jobName,jdbcType=VARCHAR}
and JOB_GROUP = #{jobGroup,jdbcType=VARCHAR} and JOB_GROUP = #{jobGroup,jdbcType=VARCHAR}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="org.example.pojo.JobDetailKey">
<delete id="deleteByPrimaryKey" parameterType="cn.chjyj.szwh.bean.JobDetailKey">
delete delete
from qrtz_job_details from qrtz_job_details
where SCHED_NAME = #{schedName,jdbcType=VARCHAR} where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
and JOB_NAME = #{jobName,jdbcType=VARCHAR} and JOB_NAME = #{jobName,jdbcType=VARCHAR}
and JOB_GROUP = #{jobGroup,jdbcType=VARCHAR} and JOB_GROUP = #{jobGroup,jdbcType=VARCHAR}
</delete> </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, insert into qrtz_job_details (SCHED_NAME, JOB_NAME, JOB_GROUP,
DESCRIPTION, JOB_CLASS_NAME, IS_DURABLE, DESCRIPTION, JOB_CLASS_NAME, IS_DURABLE,
IS_NONCONCURRENT, IS_UPDATE_DATA, REQUESTS_RECOVERY, IS_NONCONCURRENT,
IS_UPDATE_DATA,
REQUESTS_RECOVERY,
JOB_DATA) JOB_DATA)
values (#{schedName,jdbcType=VARCHAR}, #{jobName,jdbcType=VARCHAR}, #{jobGroup,jdbcType=VARCHAR}, values (#{schedName,jdbcType=VARCHAR}, #{jobName,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR}, #{jobClassName,jdbcType=VARCHAR}, #{isDurable,jdbcType=VARCHAR}, #{jobGroup,jdbcType=VARCHAR},
#{isNonconcurrent,jdbcType=VARCHAR}, #{isUpdateData,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{jobClassName,jdbcType=VARCHAR},
#{isDurable,jdbcType=VARCHAR},
#{isNonconcurrent,jdbcType=VARCHAR},
#{isUpdateData,jdbcType=VARCHAR},
#{requestsRecovery,jdbcType=VARCHAR}, #{requestsRecovery,jdbcType=VARCHAR},
#{jobData,jdbcType=LONGVARBINARY}) #{jobData,jdbcType=LONGVARBINARY})
</insert> </insert>
<insert id="insertSelective" parameterType="org.example.pojo.JobDetail">
<insert id="insertSelective" parameterType="cn.chjyj.szwh.bean.JobDetail">
insert into qrtz_job_details insert into qrtz_job_details
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="schedName != null"> <if test="schedName != null">
@ -137,7 +145,7 @@
</if> </if>
</trim> </trim>
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="org.example.pojo.JobDetail"> <update id="updateByPrimaryKeySelective" parameterType="cn.chjyj.szwh.bean.JobDetail">
update qrtz_job_details update qrtz_job_details
<set> <set>
<if test="description != null"> <if test="description != null">
@ -166,7 +174,8 @@
and JOB_NAME = #{jobName,jdbcType=VARCHAR} and JOB_NAME = #{jobName,jdbcType=VARCHAR}
and JOB_GROUP = #{jobGroup,jdbcType=VARCHAR} and JOB_GROUP = #{jobGroup,jdbcType=VARCHAR}
</update> </update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="org.example.pojo.JobDetail">
<update id="updateByPrimaryKeyWithBLOBs" parameterType="cn.chjyj.szwh.bean.JobDetail">
update qrtz_job_details update qrtz_job_details
set DESCRIPTION = #{description,jdbcType=VARCHAR}, set DESCRIPTION = #{description,jdbcType=VARCHAR},
JOB_CLASS_NAME = #{jobClassName,jdbcType=VARCHAR}, JOB_CLASS_NAME = #{jobClassName,jdbcType=VARCHAR},
@ -179,7 +188,8 @@
and JOB_NAME = #{jobName,jdbcType=VARCHAR} and JOB_NAME = #{jobName,jdbcType=VARCHAR}
and JOB_GROUP = #{jobGroup,jdbcType=VARCHAR} and JOB_GROUP = #{jobGroup,jdbcType=VARCHAR}
</update> </update>
<update id="updateByPrimaryKey" parameterType="org.example.pojo.JobDetail">
<update id="updateByPrimaryKey" parameterType="cn.chjyj.szwh.bean.JobDetail">
update qrtz_job_details update qrtz_job_details
set DESCRIPTION = #{description,jdbcType=VARCHAR}, set DESCRIPTION = #{description,jdbcType=VARCHAR},
JOB_CLASS_NAME = #{jobClassName,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"?> <?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"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.example.mapper.TriggerMapper"> <mapper namespace="cn.chjyj.szwh.mapper.TriggerMapper">
<resultMap id="BaseResultMap" type="org.example.pojo.Trigger"> <resultMap id="BaseResultMap" type="cn.chjyj.szwh.bean.Trigger">
<id column="SCHED_NAME" jdbcType="VARCHAR" property="schedName" /> <id column="SCHED_NAME" jdbcType="VARCHAR" property="schedName"/>
<id column="TRIGGER_NAME" jdbcType="VARCHAR" property="triggerName" /> <id column="TRIGGER_NAME" jdbcType="VARCHAR" property="triggerName"/>
<id column="TRIGGER_GROUP" jdbcType="VARCHAR" property="triggerGroup" /> <id column="TRIGGER_GROUP" jdbcType="VARCHAR" property="triggerGroup"/>
<result column="JOB_NAME" jdbcType="VARCHAR" property="jobName" /> <result column="JOB_NAME" jdbcType="VARCHAR" property="jobName"/>
<result column="JOB_GROUP" jdbcType="VARCHAR" property="jobGroup" /> <result column="JOB_GROUP" jdbcType="VARCHAR" property="jobGroup"/>
<result column="DESCRIPTION" jdbcType="VARCHAR" property="description" /> <result column="DESCRIPTION" jdbcType="VARCHAR" property="description"/>
<result column="NEXT_FIRE_TIME" jdbcType="BIGINT" property="nextFireTime" /> <result column="NEXT_FIRE_TIME" jdbcType="BIGINT" property="nextFireTime"/>
<result column="PREV_FIRE_TIME" jdbcType="BIGINT" property="prevFireTime" /> <result column="PREV_FIRE_TIME" jdbcType="BIGINT" property="prevFireTime"/>
<result column="PRIORITY" jdbcType="INTEGER" property="priority" /> <result column="PRIORITY" jdbcType="INTEGER" property="priority"/>
<result column="TRIGGER_STATE" jdbcType="VARCHAR" property="triggerState" /> <result column="TRIGGER_STATE" jdbcType="VARCHAR" property="triggerState"/>
<result column="TRIGGER_TYPE" jdbcType="VARCHAR" property="triggerType" /> <result column="TRIGGER_TYPE" jdbcType="VARCHAR" property="triggerType"/>
<result column="START_TIME" jdbcType="BIGINT" property="startTime" /> <result column="START_TIME" jdbcType="BIGINT" property="startTime"/>
<result column="END_TIME" jdbcType="BIGINT" property="endTime" /> <result column="END_TIME" jdbcType="BIGINT" property="endTime"/>
<result column="CALENDAR_NAME" jdbcType="VARCHAR" property="calendarName" /> <result column="CALENDAR_NAME" jdbcType="VARCHAR" property="calendarName"/>
<result column="MISFIRE_INSTR" jdbcType="SMALLINT" property="misfireInstr" /> <result column="MISFIRE_INSTR" jdbcType="SMALLINT" property="misfireInstr"/>
</resultMap> </resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="org.example.pojo.Trigger"> <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="cn.chjyj.szwh.bean.Trigger">
<result column="JOB_DATA" jdbcType="LONGVARBINARY" property="jobData" /> <result column="JOB_DATA" jdbcType="LONGVARBINARY" property="jobData"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP, JOB_NAME, JOB_GROUP, DESCRIPTION, NEXT_FIRE_TIME, 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, PREV_FIRE_TIME, PRIORITY, TRIGGER_STATE, TRIGGER_TYPE, START_TIME, END_TIME, CALENDAR_NAME,
MISFIRE_INSTR MISFIRE_INSTR
</sql> </sql>
<sql id="Blob_Column_List"> <sql id="Blob_Column_List">
JOB_DATA JOB_DATA
</sql> </sql>
<select id="selectByPrimaryKey" parameterType="org.example.pojo.TriggerKey" resultMap="ResultMapWithBLOBs"> <select id="selectByPrimaryKey" parameterType="cn.chjyj.szwh.bean.TriggerKey" resultMap="ResultMapWithBLOBs">
select select
<include refid="Base_Column_List" /> <include refid="Base_Column_List"/>
, ,
<include refid="Blob_Column_List" /> <include refid="Blob_Column_List"/>
from qrtz_triggers from qrtz_triggers
where SCHED_NAME = #{schedName,jdbcType=VARCHAR} where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR} and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR}
and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR} and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR}
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="org.example.pojo.TriggerKey"> <delete id="deleteByPrimaryKey" parameterType="cn.chjyj.szwh.bean.TriggerKey">
delete from qrtz_triggers delete from qrtz_triggers
where SCHED_NAME = #{schedName,jdbcType=VARCHAR} where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR} and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR}
and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR} and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR}
</delete> </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, insert into qrtz_triggers (SCHED_NAME, TRIGGER_NAME, TRIGGER_GROUP,
JOB_NAME, JOB_GROUP, DESCRIPTION, JOB_NAME, JOB_GROUP, DESCRIPTION,
NEXT_FIRE_TIME, PREV_FIRE_TIME, PRIORITY, NEXT_FIRE_TIME, PREV_FIRE_TIME, PRIORITY,
@ -59,157 +59,157 @@
#{endTime,jdbcType=BIGINT}, #{calendarName,jdbcType=VARCHAR}, #{misfireInstr,jdbcType=SMALLINT}, #{endTime,jdbcType=BIGINT}, #{calendarName,jdbcType=VARCHAR}, #{misfireInstr,jdbcType=SMALLINT},
#{jobData,jdbcType=LONGVARBINARY}) #{jobData,jdbcType=LONGVARBINARY})
</insert> </insert>
<insert id="insertSelective" parameterType="org.example.pojo.Trigger"> <insert id="insertSelective" parameterType="cn.chjyj.szwh.bean.Trigger">
insert into qrtz_triggers insert into qrtz_triggers
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="schedName != null"> <if test="schedName != null">
SCHED_NAME, SCHED_NAME,
</if> </if>
<if test="triggerName != null"> <if test="triggerName != null">
TRIGGER_NAME, TRIGGER_NAME,
</if> </if>
<if test="triggerGroup != null"> <if test="triggerGroup != null">
TRIGGER_GROUP, TRIGGER_GROUP,
</if> </if>
<if test="jobName != null"> <if test="jobName != null">
JOB_NAME, JOB_NAME,
</if> </if>
<if test="jobGroup != null"> <if test="jobGroup != null">
JOB_GROUP, JOB_GROUP,
</if> </if>
<if test="description != null"> <if test="description != null">
DESCRIPTION, DESCRIPTION,
</if> </if>
<if test="nextFireTime != null"> <if test="nextFireTime != null">
NEXT_FIRE_TIME, NEXT_FIRE_TIME,
</if> </if>
<if test="prevFireTime != null"> <if test="prevFireTime != null">
PREV_FIRE_TIME, PREV_FIRE_TIME,
</if> </if>
<if test="priority != null"> <if test="priority != null">
PRIORITY, PRIORITY,
</if> </if>
<if test="triggerState != null"> <if test="triggerState != null">
TRIGGER_STATE, TRIGGER_STATE,
</if> </if>
<if test="triggerType != null"> <if test="triggerType != null">
TRIGGER_TYPE, TRIGGER_TYPE,
</if> </if>
<if test="startTime != null"> <if test="startTime != null">
START_TIME, START_TIME,
</if> </if>
<if test="endTime != null"> <if test="endTime != null">
END_TIME, END_TIME,
</if> </if>
<if test="calendarName != null"> <if test="calendarName != null">
CALENDAR_NAME, CALENDAR_NAME,
</if> </if>
<if test="misfireInstr != null"> <if test="misfireInstr != null">
MISFIRE_INSTR, MISFIRE_INSTR,
</if> </if>
<if test="jobData != null"> <if test="jobData != null">
JOB_DATA, JOB_DATA,
</if> </if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="schedName != null"> <if test="schedName != null">
#{schedName,jdbcType=VARCHAR}, #{schedName,jdbcType=VARCHAR},
</if> </if>
<if test="triggerName != null"> <if test="triggerName != null">
#{triggerName,jdbcType=VARCHAR}, #{triggerName,jdbcType=VARCHAR},
</if> </if>
<if test="triggerGroup != null"> <if test="triggerGroup != null">
#{triggerGroup,jdbcType=VARCHAR}, #{triggerGroup,jdbcType=VARCHAR},
</if> </if>
<if test="jobName != null"> <if test="jobName != null">
#{jobName,jdbcType=VARCHAR}, #{jobName,jdbcType=VARCHAR},
</if> </if>
<if test="jobGroup != null"> <if test="jobGroup != null">
#{jobGroup,jdbcType=VARCHAR}, #{jobGroup,jdbcType=VARCHAR},
</if> </if>
<if test="description != null"> <if test="description != null">
#{description,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
</if> </if>
<if test="nextFireTime != null"> <if test="nextFireTime != null">
#{nextFireTime,jdbcType=BIGINT}, #{nextFireTime,jdbcType=BIGINT},
</if> </if>
<if test="prevFireTime != null"> <if test="prevFireTime != null">
#{prevFireTime,jdbcType=BIGINT}, #{prevFireTime,jdbcType=BIGINT},
</if> </if>
<if test="priority != null"> <if test="priority != null">
#{priority,jdbcType=INTEGER}, #{priority,jdbcType=INTEGER},
</if> </if>
<if test="triggerState != null"> <if test="triggerState != null">
#{triggerState,jdbcType=VARCHAR}, #{triggerState,jdbcType=VARCHAR},
</if> </if>
<if test="triggerType != null"> <if test="triggerType != null">
#{triggerType,jdbcType=VARCHAR}, #{triggerType,jdbcType=VARCHAR},
</if> </if>
<if test="startTime != null"> <if test="startTime != null">
#{startTime,jdbcType=BIGINT}, #{startTime,jdbcType=BIGINT},
</if> </if>
<if test="endTime != null"> <if test="endTime != null">
#{endTime,jdbcType=BIGINT}, #{endTime,jdbcType=BIGINT},
</if> </if>
<if test="calendarName != null"> <if test="calendarName != null">
#{calendarName,jdbcType=VARCHAR}, #{calendarName,jdbcType=VARCHAR},
</if> </if>
<if test="misfireInstr != null"> <if test="misfireInstr != null">
#{misfireInstr,jdbcType=SMALLINT}, #{misfireInstr,jdbcType=SMALLINT},
</if> </if>
<if test="jobData != null"> <if test="jobData != null">
#{jobData,jdbcType=LONGVARBINARY}, #{jobData,jdbcType=LONGVARBINARY},
</if> </if>
</trim> </trim>
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="org.example.pojo.Trigger"> <update id="updateByPrimaryKeySelective" parameterType="cn.chjyj.szwh.bean.Trigger">
update qrtz_triggers update qrtz_triggers
<set> <set>
<if test="jobName != null"> <if test="jobName != null">
JOB_NAME = #{jobName,jdbcType=VARCHAR}, JOB_NAME = #{jobName,jdbcType=VARCHAR},
</if> </if>
<if test="jobGroup != null"> <if test="jobGroup != null">
JOB_GROUP = #{jobGroup,jdbcType=VARCHAR}, JOB_GROUP = #{jobGroup,jdbcType=VARCHAR},
</if> </if>
<if test="description != null"> <if test="description != null">
DESCRIPTION = #{description,jdbcType=VARCHAR}, DESCRIPTION = #{description,jdbcType=VARCHAR},
</if> </if>
<if test="nextFireTime != null"> <if test="nextFireTime != null">
NEXT_FIRE_TIME = #{nextFireTime,jdbcType=BIGINT}, NEXT_FIRE_TIME = #{nextFireTime,jdbcType=BIGINT},
</if> </if>
<if test="prevFireTime != null"> <if test="prevFireTime != null">
PREV_FIRE_TIME = #{prevFireTime,jdbcType=BIGINT}, PREV_FIRE_TIME = #{prevFireTime,jdbcType=BIGINT},
</if> </if>
<if test="priority != null"> <if test="priority != null">
PRIORITY = #{priority,jdbcType=INTEGER}, PRIORITY = #{priority,jdbcType=INTEGER},
</if> </if>
<if test="triggerState != null"> <if test="triggerState != null">
TRIGGER_STATE = #{triggerState,jdbcType=VARCHAR}, TRIGGER_STATE = #{triggerState,jdbcType=VARCHAR},
</if> </if>
<if test="triggerType != null"> <if test="triggerType != null">
TRIGGER_TYPE = #{triggerType,jdbcType=VARCHAR}, TRIGGER_TYPE = #{triggerType,jdbcType=VARCHAR},
</if> </if>
<if test="startTime != null"> <if test="startTime != null">
START_TIME = #{startTime,jdbcType=BIGINT}, START_TIME = #{startTime,jdbcType=BIGINT},
</if> </if>
<if test="endTime != null"> <if test="endTime != null">
END_TIME = #{endTime,jdbcType=BIGINT}, END_TIME = #{endTime,jdbcType=BIGINT},
</if> </if>
<if test="calendarName != null"> <if test="calendarName != null">
CALENDAR_NAME = #{calendarName,jdbcType=VARCHAR}, CALENDAR_NAME = #{calendarName,jdbcType=VARCHAR},
</if> </if>
<if test="misfireInstr != null"> <if test="misfireInstr != null">
MISFIRE_INSTR = #{misfireInstr,jdbcType=SMALLINT}, MISFIRE_INSTR = #{misfireInstr,jdbcType=SMALLINT},
</if> </if>
<if test="jobData != null"> <if test="jobData != null">
JOB_DATA = #{jobData,jdbcType=LONGVARBINARY}, JOB_DATA = #{jobData,jdbcType=LONGVARBINARY},
</if> </if>
</set> </set>
where SCHED_NAME = #{schedName,jdbcType=VARCHAR} where SCHED_NAME = #{schedName,jdbcType=VARCHAR}
and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR} and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR}
and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR} and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR}
</update> </update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="org.example.pojo.Trigger"> <update id="updateByPrimaryKeyWithBLOBs" parameterType="cn.chjyj.szwh.bean.Trigger">
update qrtz_triggers update qrtz_triggers
set JOB_NAME = #{jobName,jdbcType=VARCHAR}, set JOB_NAME = #{jobName,jdbcType=VARCHAR},
JOB_GROUP = #{jobGroup,jdbcType=VARCHAR}, JOB_GROUP = #{jobGroup,jdbcType=VARCHAR},
@ -228,7 +228,7 @@
and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR} and TRIGGER_NAME = #{triggerName,jdbcType=VARCHAR}
and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR} and TRIGGER_GROUP = #{triggerGroup,jdbcType=VARCHAR}
</update> </update>
<update id="updateByPrimaryKey" parameterType="org.example.pojo.Trigger"> <update id="updateByPrimaryKey" parameterType="cn.chjyj.szwh.bean.Trigger">
update qrtz_triggers update qrtz_triggers
set JOB_NAME = #{jobName,jdbcType=VARCHAR}, set JOB_NAME = #{jobName,jdbcType=VARCHAR},
JOB_GROUP = #{jobGroup,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.instanceId=AUTO
org.quartz.scheduler.instanceName=DefaultQuartzScheduler org.quartz.scheduler.instanceName=SzwhScheduler
#如果您希望Quartz Scheduler通过RMI作为服务器导出本身,则将“rmi.export”标志设置为true #如果您希望Quartz Scheduler通过RMI作为服务器导出本身,则将“rmi.export”标志设置为true
#在同一个配置文件中为'org.quartz.scheduler.rmi.export'和'org.quartz.scheduler.rmi.proxy'指定一个'true'值是没有意义的,如果你这样做'export'选项将被忽略 #在同一个配置文件中为'org.quartz.scheduler.rmi.export'和'org.quartz.scheduler.rmi.proxy'指定一个'true'值是没有意义的,如果你这样做'export'选项将被忽略
org.quartz.scheduler.rmi.export=false org.quartz.scheduler.rmi.export=false
@ -39,15 +39,16 @@ org.quartz.jobStore.useProperties=true
#表前缀 #表前缀
org.quartz.jobStore.tablePrefix=QRTZ_ org.quartz.jobStore.tablePrefix=QRTZ_
#数据源别名,自定义 #数据源别名,自定义
org.quartz.jobStore.dataSource=qzDS org.quartz.jobStore.dataSource=datasoure
#org.quartz.jobStore.dataSource=qzDS
#使用阿里的druid作为数据库连接池 #使用阿里的druid作为数据库连接池
org.quartz.dataSource.qzDS.connectionProvider.class=org.example.config.DruidPoolingconnectionProvider #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.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.user=root
org.quartz.dataSource.qzDS.password=123456 #org.quartz.dataSource.qzDS.password=123456
org.quartz.dataSource.qzDS.driver=com.mysql.jdbc.Driver #org.quartz.dataSource.qzDS.driver=com.mysql.jdbc.Driver
org.quartz.dataSource.qzDS.maxConnections=10 #org.quartz.dataSource.qzDS.maxConnections=10
#设置为“true”以打开群集功能。如果您有多个Quartz实例使用同一组数据库表,则此属性必须设置为“true”,否则您将遇到破坏 #设置为“true”以打开群集功能。如果您有多个Quartz实例使用同一组数据库表,则此属性必须设置为“true”,否则您将遇到破坏
#org.quartz.jobStore.isClustered=false #org.quartz.jobStore.isClustered=false

Loading…
Cancel
Save