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. 28
      src/main/resources/mapper/szwh/CronTriggerMapper.xml
  7. 40
      src/main/resources/mapper/szwh/JobDetailMapper.xml
  8. 56
      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

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

@ -1,37 +1,37 @@
<?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">
@ -68,7 +68,7 @@
</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">
@ -82,7 +82,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.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},

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

@ -1,25 +1,25 @@
<?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,
@ -29,23 +29,23 @@
<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,7 +59,7 @@
#{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">
@ -162,7 +162,7 @@
</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">
@ -209,7 +209,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="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