update document

pull/10/head
xuxueli 6 years ago
parent 17d986521f
commit ba3a695a3b

@ -778,13 +778,13 @@ try{
### 5.2 “调度数据库”配置 ### 5.2 “调度数据库”配置
XXL-JOB调度模块基于自研调度组件并支持集群部署调度数据库表说明如下 XXL-JOB调度模块基于自研调度组件并支持集群部署调度数据库表说明如下
- XXL_JOB_LOCK:任务调度锁表; - xxl_job_lock:任务调度锁表;
- XXL_JOB_GROUP:执行器信息表,维护任务执行器信息; - xxl_job_group:执行器信息表,维护任务执行器信息;
- XXL_JOB_INFO:调度扩展信息表: 用于保存XXL-JOB调度任务的扩展信息如任务分组、任务名、机器地址、执行器、执行入参和报警邮件等等 - xxl_job_info:调度扩展信息表: 用于保存XXL-JOB调度任务的扩展信息如任务分组、任务名、机器地址、执行器、执行入参和报警邮件等等
- XXL_JOB_LOG:调度日志表: 用于保存XXL-JOB任务调度的历史信息如调度结果、执行结果、调度入参、调度机器和执行器等等 - xxl_job_log:调度日志表: 用于保存XXL-JOB任务调度的历史信息如调度结果、执行结果、调度入参、调度机器和执行器等等
- XXL_JOB_LOGGLUE任务GLUE日志用于保存GLUE更新历史用于支持GLUE的版本回溯功能 - xxl_job_logglue任务GLUE日志用于保存GLUE更新历史用于支持GLUE的版本回溯功能
- XXL_JOB_REGISTRY:执行器注册表,维护在线的执行器和调度中心机器地址信息; - xxl_job_registry:执行器注册表,维护在线的执行器和调度中心机器地址信息;
- XXL_JOB_USER:系统用户表; - xxl_job_user:系统用户表;
### 5.3 架构设计 ### 5.3 架构设计
@ -958,7 +958,7 @@ XXL-JOB会为每次调度请求生成一个单独的日志文件需要通过
自v1.5版本之后, 任务取消了"任务执行机器"属性, 改为通过任务注册和自动发现的方式, 动态获取远程执行器地址并执行。 自v1.5版本之后, 任务取消了"任务执行机器"属性, 改为通过任务注册和自动发现的方式, 动态获取远程执行器地址并执行。
AppName: 每个执行器机器集群的唯一标示, 任务注册以 "执行器" 为最小粒度进行注册; 每个任务通过其绑定的执行器可感知对应的执行器机器列表; AppName: 每个执行器机器集群的唯一标示, 任务注册以 "执行器" 为最小粒度进行注册; 每个任务通过其绑定的执行器可感知对应的执行器机器列表;
注册表: 见"XXL_JOB_REGISTRY"表, "执行器" 在进行任务注册时将会周期性维护一条注册记录即机器地址和AppName的绑定关系; "调度中心" 从而可以动态感知每个AppName在线的机器列表; 注册表: 见"xxl_job_registry"表, "执行器" 在进行任务注册时将会周期性维护一条注册记录即机器地址和AppName的绑定关系; "调度中心" 从而可以动态感知每个AppName在线的机器列表;
执行器注册: 任务注册Beat周期默认30s; 执行器以一倍Beat进行执行器注册, 调度中心以一倍Beat进行动态任务发现; 注册信息的失效时间被三倍Beat; 执行器注册: 任务注册Beat周期默认30s; 执行器以一倍Beat进行执行器注册, 调度中心以一倍Beat进行动态任务发现; 注册信息的失效时间被三倍Beat;
执行器注册摘除:执行器销毁时,将会主动上报调度中心并摘除对应的执行器机器信息,提高心跳注册的实时性; 执行器注册摘除:执行器销毁时,将会主动上报调度中心并摘除对应的执行器机器信息,提高心跳注册的实时性;

@ -3,7 +3,7 @@ use `xxl-job`;
CREATE TABLE `XXL_JOB_INFO` ( CREATE TABLE `xxl_job_info` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`job_group` int(11) NOT NULL COMMENT '执行器主键ID', `job_group` int(11) NOT NULL COMMENT '执行器主键ID',
`job_cron` varchar(128) NOT NULL COMMENT '任务执行CRON', `job_cron` varchar(128) NOT NULL COMMENT '任务执行CRON',
@ -29,7 +29,7 @@ CREATE TABLE `XXL_JOB_INFO` (
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `XXL_JOB_LOG` ( CREATE TABLE `xxl_job_log` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`job_group` int(11) NOT NULL COMMENT '执行器主键ID', `job_group` int(11) NOT NULL COMMENT '执行器主键ID',
`job_id` int(11) NOT NULL COMMENT '任务主键ID', `job_id` int(11) NOT NULL COMMENT '任务主键ID',
@ -50,7 +50,7 @@ CREATE TABLE `XXL_JOB_LOG` (
KEY `I_handle_code` (`handle_code`) KEY `I_handle_code` (`handle_code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `XXL_JOB_LOGGLUE` ( CREATE TABLE `xxl_job_logglue` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`job_id` int(11) NOT NULL COMMENT '任务主键ID', `job_id` int(11) NOT NULL COMMENT '任务主键ID',
`glue_type` varchar(50) DEFAULT NULL COMMENT 'GLUE类型', `glue_type` varchar(50) DEFAULT NULL COMMENT 'GLUE类型',
@ -61,7 +61,7 @@ CREATE TABLE `XXL_JOB_LOGGLUE` (
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `XXL_JOB_REGISTRY` ( CREATE TABLE `xxl_job_registry` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`registry_group` varchar(255) NOT NULL, `registry_group` varchar(255) NOT NULL,
`registry_key` varchar(255) NOT NULL, `registry_key` varchar(255) NOT NULL,
@ -71,7 +71,7 @@ CREATE TABLE `XXL_JOB_REGISTRY` (
KEY `i_g_k_v` (`registry_group`,`registry_key`,`registry_value`) KEY `i_g_k_v` (`registry_group`,`registry_key`,`registry_value`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `XXL_JOB_GROUP` ( CREATE TABLE `xxl_job_group` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`app_name` varchar(64) NOT NULL COMMENT '执行器AppName', `app_name` varchar(64) NOT NULL COMMENT '执行器AppName',
`title` varchar(12) NOT NULL COMMENT '执行器名称', `title` varchar(12) NOT NULL COMMENT '执行器名称',
@ -81,7 +81,7 @@ CREATE TABLE `XXL_JOB_GROUP` (
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `XXL_JOB_USER` ( CREATE TABLE `xxl_job_user` (
`id` int(11) NOT NULL AUTO_INCREMENT, `id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(50) NOT NULL COMMENT '账号', `username` varchar(50) NOT NULL COMMENT '账号',
`password` varchar(50) NOT NULL COMMENT '密码', `password` varchar(50) NOT NULL COMMENT '密码',
@ -91,16 +91,16 @@ CREATE TABLE `XXL_JOB_USER` (
UNIQUE KEY `i_username` (`username`) USING BTREE UNIQUE KEY `i_username` (`username`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `XXL_JOB_LOCK` ( CREATE TABLE `xxl_job_lock` (
`lock_name` varchar(50) NOT NULL COMMENT '锁名称', `lock_name` varchar(50) NOT NULL COMMENT '锁名称',
PRIMARY KEY (`lock_name`) PRIMARY KEY (`lock_name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `XXL_JOB_GROUP`(`id`, `app_name`, `title`, `order`, `address_type`, `address_list`) VALUES (1, 'xxl-job-executor-sample', '示例执行器', 1, 0, NULL); INSERT INTO `xxl_job_group`(`id`, `app_name`, `title`, `order`, `address_type`, `address_list`) VALUES (1, 'xxl-job-executor-sample', '示例执行器', 1, 0, NULL);
INSERT INTO `XXL_JOB_INFO`(`id`, `job_group`, `job_cron`, `job_desc`, `add_time`, `update_time`, `author`, `alarm_email`, `executor_route_strategy`, `executor_handler`, `executor_param`, `executor_block_strategy`, `executor_timeout`, `executor_fail_retry_count`, `glue_type`, `glue_source`, `glue_remark`, `glue_updatetime`, `child_jobid`) VALUES (1, 1, '0 0 0 * * ? *', '测试任务1', '2018-11-03 22:21:31', '2018-11-03 22:21:31', 'XXL', '', 'FIRST', 'demoJobHandler', '', 'SERIAL_EXECUTION', 0, 0, 'BEAN', '', 'GLUE代码初始化', '2018-11-03 22:21:31', ''); INSERT INTO `xxl_job_info`(`id`, `job_group`, `job_cron`, `job_desc`, `add_time`, `update_time`, `author`, `alarm_email`, `executor_route_strategy`, `executor_handler`, `executor_param`, `executor_block_strategy`, `executor_timeout`, `executor_fail_retry_count`, `glue_type`, `glue_source`, `glue_remark`, `glue_updatetime`, `child_jobid`) VALUES (1, 1, '0 0 0 * * ? *', '测试任务1', '2018-11-03 22:21:31', '2018-11-03 22:21:31', 'XXL', '', 'FIRST', 'demoJobHandler', '', 'SERIAL_EXECUTION', 0, 0, 'BEAN', '', 'GLUE代码初始化', '2018-11-03 22:21:31', '');
INSERT INTO `XXL_JOB_USER`(`id`, `username`, `password`, `role`, `permission`) VALUES (1, 'admin', 'e10adc3949ba59abbe56e057f20f883e', 1, NULL); INSERT INTO `xxl_job_user`(`id`, `username`, `password`, `role`, `permission`) VALUES (1, 'admin', 'e10adc3949ba59abbe56e057f20f883e', 1, NULL);
INSERT INTO `XXL_JOB_LOCK` ( `lock_name`) VALUES ( 'schedule_lock'); INSERT INTO `xxl_job_lock` ( `lock_name`) VALUES ( 'schedule_lock');
commit; commit;

@ -58,7 +58,7 @@ public class JobScheduleHelper {
} }
conn.setAutoCommit(false); conn.setAutoCommit(false);
preparedStatement = conn.prepareStatement( "select * from XXL_JOB_LOCK where lock_name = 'schedule_lock' for update" ); preparedStatement = conn.prepareStatement( "select * from xxl_job_lock where lock_name = 'schedule_lock' for update" );
preparedStatement.execute(); preparedStatement.execute();
// tx start // tx start

@ -23,24 +23,24 @@
<select id="findAll" resultMap="XxlJobGroup"> <select id="findAll" resultMap="XxlJobGroup">
SELECT <include refid="Base_Column_List" /> SELECT <include refid="Base_Column_List" />
FROM XXL_JOB_GROUP AS t FROM xxl_job_group AS t
ORDER BY t.order ASC ORDER BY t.order ASC
</select> </select>
<select id="findByAddressType" parameterType="java.lang.Integer" resultMap="XxlJobGroup"> <select id="findByAddressType" parameterType="java.lang.Integer" resultMap="XxlJobGroup">
SELECT <include refid="Base_Column_List" /> SELECT <include refid="Base_Column_List" />
FROM XXL_JOB_GROUP AS t FROM xxl_job_group AS t
WHERE t.address_type = #{addressType} WHERE t.address_type = #{addressType}
ORDER BY t.order ASC ORDER BY t.order ASC
</select> </select>
<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobGroup" useGeneratedKeys="true" keyProperty="id" > <insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobGroup" useGeneratedKeys="true" keyProperty="id" >
INSERT INTO XXL_JOB_GROUP ( `app_name`, `title`, `order`, `address_type`, `address_list`) INSERT INTO xxl_job_group ( `app_name`, `title`, `order`, `address_type`, `address_list`)
values ( #{appName}, #{title}, #{order}, #{addressType}, #{addressList}); values ( #{appName}, #{title}, #{order}, #{addressType}, #{addressList});
</insert> </insert>
<update id="update" parameterType="com.xxl.job.admin.core.model.XxlJobGroup" > <update id="update" parameterType="com.xxl.job.admin.core.model.XxlJobGroup" >
UPDATE XXL_JOB_GROUP UPDATE xxl_job_group
SET `app_name` = #{appName}, SET `app_name` = #{appName},
`title` = #{title}, `title` = #{title},
`order` = #{order}, `order` = #{order},
@ -50,13 +50,13 @@
</update> </update>
<delete id="remove" parameterType="java.lang.Integer" > <delete id="remove" parameterType="java.lang.Integer" >
DELETE FROM XXL_JOB_GROUP DELETE FROM xxl_job_group
WHERE id = #{id} WHERE id = #{id}
</delete> </delete>
<select id="load" parameterType="java.lang.Integer" resultMap="XxlJobGroup"> <select id="load" parameterType="java.lang.Integer" resultMap="XxlJobGroup">
SELECT <include refid="Base_Column_List" /> SELECT <include refid="Base_Column_List" />
FROM XXL_JOB_GROUP AS t FROM xxl_job_group AS t
WHERE t.id = #{id} WHERE t.id = #{id}
</select> </select>

@ -62,7 +62,7 @@
<select id="pageList" parameterType="java.util.HashMap" resultMap="XxlJobInfo"> <select id="pageList" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
SELECT <include refid="Base_Column_List" /> SELECT <include refid="Base_Column_List" />
FROM XXL_JOB_INFO AS t FROM xxl_job_info AS t
<trim prefix="WHERE" prefixOverrides="AND | OR" > <trim prefix="WHERE" prefixOverrides="AND | OR" >
<if test="jobGroup gt 0"> <if test="jobGroup gt 0">
AND t.job_group = #{jobGroup} AND t.job_group = #{jobGroup}
@ -83,7 +83,7 @@
<select id="pageListCount" parameterType="java.util.HashMap" resultType="int"> <select id="pageListCount" parameterType="java.util.HashMap" resultType="int">
SELECT count(1) SELECT count(1)
FROM XXL_JOB_INFO AS t FROM xxl_job_info AS t
<trim prefix="WHERE" prefixOverrides="AND | OR" > <trim prefix="WHERE" prefixOverrides="AND | OR" >
<if test="jobGroup gt 0"> <if test="jobGroup gt 0">
AND t.job_group = #{jobGroup} AND t.job_group = #{jobGroup}
@ -101,7 +101,7 @@
</select> </select>
<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobInfo" useGeneratedKeys="true" keyProperty="id" > <insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobInfo" useGeneratedKeys="true" keyProperty="id" >
INSERT INTO XXL_JOB_INFO ( INSERT INTO xxl_job_info (
job_group, job_group,
job_cron, job_cron,
job_desc, job_desc,
@ -154,12 +154,12 @@
<select id="loadById" parameterType="java.util.HashMap" resultMap="XxlJobInfo"> <select id="loadById" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
SELECT <include refid="Base_Column_List" /> SELECT <include refid="Base_Column_List" />
FROM XXL_JOB_INFO AS t FROM xxl_job_info AS t
WHERE t.id = #{id} WHERE t.id = #{id}
</select> </select>
<update id="update" parameterType="com.xxl.job.admin.core.model.XxlJobInfo" > <update id="update" parameterType="com.xxl.job.admin.core.model.XxlJobInfo" >
UPDATE XXL_JOB_INFO UPDATE xxl_job_info
SET SET
job_group = #{jobGroup}, job_group = #{jobGroup},
job_cron = #{jobCron}, job_cron = #{jobCron},
@ -186,31 +186,31 @@
<delete id="delete" parameterType="java.util.HashMap"> <delete id="delete" parameterType="java.util.HashMap">
DELETE DELETE
FROM XXL_JOB_INFO FROM xxl_job_info
WHERE id = #{id} WHERE id = #{id}
</delete> </delete>
<select id="getJobsByGroup" parameterType="java.util.HashMap" resultMap="XxlJobInfo"> <select id="getJobsByGroup" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
SELECT <include refid="Base_Column_List" /> SELECT <include refid="Base_Column_List" />
FROM XXL_JOB_INFO AS t FROM xxl_job_info AS t
WHERE t.job_group = #{jobGroup} WHERE t.job_group = #{jobGroup}
</select> </select>
<select id="findAllCount" resultType="int"> <select id="findAllCount" resultType="int">
SELECT count(1) SELECT count(1)
FROM XXL_JOB_INFO FROM xxl_job_info
</select> </select>
<select id="scheduleJobQuery" parameterType="java.util.HashMap" resultMap="XxlJobInfo"> <select id="scheduleJobQuery" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
SELECT <include refid="Base_Column_List" /> SELECT <include refid="Base_Column_List" />
FROM XXL_JOB_INFO AS t FROM xxl_job_info AS t
WHERE t.trigger_status = 1 WHERE t.trigger_status = 1
and t.trigger_next_time<![CDATA[ < ]]> #{maxNextTime} and t.trigger_next_time<![CDATA[ < ]]> #{maxNextTime}
</select> </select>
<update id="scheduleUpdate" parameterType="com.xxl.job.admin.core.model.XxlJobInfo" > <update id="scheduleUpdate" parameterType="com.xxl.job.admin.core.model.XxlJobInfo" >
UPDATE XXL_JOB_INFO UPDATE xxl_job_info
SET SET
trigger_last_time = #{triggerLastTime}, trigger_last_time = #{triggerLastTime},
trigger_next_time = #{triggerNextTime} trigger_next_time = #{triggerNextTime}

@ -24,7 +24,7 @@
</sql> </sql>
<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobLogGlue" useGeneratedKeys="true" keyProperty="id" > <insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobLogGlue" useGeneratedKeys="true" keyProperty="id" >
INSERT INTO XXL_JOB_LOGGLUE ( INSERT INTO xxl_job_logglue (
`job_id`, `job_id`,
`glue_type`, `glue_type`,
`glue_source`, `glue_source`,
@ -46,16 +46,16 @@
<select id="findByJobId" parameterType="java.lang.Integer" resultMap="XxlJobLogGlue"> <select id="findByJobId" parameterType="java.lang.Integer" resultMap="XxlJobLogGlue">
SELECT <include refid="Base_Column_List" /> SELECT <include refid="Base_Column_List" />
FROM XXL_JOB_LOGGLUE AS t FROM xxl_job_logglue AS t
WHERE t.job_id = #{jobId} WHERE t.job_id = #{jobId}
ORDER BY id DESC ORDER BY id DESC
</select> </select>
<delete id="removeOld" > <delete id="removeOld" >
DELETE FROM XXL_JOB_LOGGLUE DELETE FROM xxl_job_logglue
WHERE id NOT in( WHERE id NOT in(
SELECT id FROM( SELECT id FROM(
SELECT id FROM XXL_JOB_LOGGLUE SELECT id FROM xxl_job_logglue
WHERE `job_id` = #{jobId} WHERE `job_id` = #{jobId}
ORDER BY update_time desc ORDER BY update_time desc
LIMIT 0, #{limit} LIMIT 0, #{limit}
@ -64,7 +64,7 @@
</delete> </delete>
<delete id="deleteByJobId" parameterType="java.lang.Integer" > <delete id="deleteByJobId" parameterType="java.lang.Integer" >
DELETE FROM XXL_JOB_LOGGLUE DELETE FROM xxl_job_logglue
WHERE `job_id` = #{jobId} WHERE `job_id` = #{jobId}
</delete> </delete>

@ -46,7 +46,7 @@
<select id="pageList" resultMap="XxlJobLog"> <select id="pageList" resultMap="XxlJobLog">
SELECT <include refid="Base_Column_List" /> SELECT <include refid="Base_Column_List" />
FROM XXL_JOB_LOG AS t FROM xxl_job_log AS t
<trim prefix="WHERE" prefixOverrides="AND | OR" > <trim prefix="WHERE" prefixOverrides="AND | OR" >
<if test="jobId==0 and jobGroup gt 0"> <if test="jobId==0 and jobGroup gt 0">
AND t.job_group = #{jobGroup} AND t.job_group = #{jobGroup}
@ -80,7 +80,7 @@
<select id="pageListCount" resultType="int"> <select id="pageListCount" resultType="int">
SELECT count(1) SELECT count(1)
FROM XXL_JOB_LOG AS t FROM xxl_job_log AS t
<trim prefix="WHERE" prefixOverrides="AND | OR" > <trim prefix="WHERE" prefixOverrides="AND | OR" >
<if test="jobId==0 and jobGroup gt 0"> <if test="jobId==0 and jobGroup gt 0">
AND t.job_group = #{jobGroup} AND t.job_group = #{jobGroup}
@ -112,13 +112,13 @@
<select id="load" parameterType="java.lang.Integer" resultMap="XxlJobLog"> <select id="load" parameterType="java.lang.Integer" resultMap="XxlJobLog">
SELECT <include refid="Base_Column_List" /> SELECT <include refid="Base_Column_List" />
FROM XXL_JOB_LOG AS t FROM xxl_job_log AS t
WHERE t.id = #{id} WHERE t.id = #{id}
</select> </select>
<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobLog" useGeneratedKeys="true" keyProperty="id" > <insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobLog" useGeneratedKeys="true" keyProperty="id" >
INSERT INTO XXL_JOB_LOG ( INSERT INTO xxl_job_log (
`job_group`, `job_group`,
`job_id`, `job_id`,
`trigger_time`, `trigger_time`,
@ -137,7 +137,7 @@
</insert> </insert>
<update id="updateTriggerInfo" > <update id="updateTriggerInfo" >
UPDATE XXL_JOB_LOG UPDATE xxl_job_log
SET SET
`trigger_time`= #{triggerTime}, `trigger_time`= #{triggerTime},
`trigger_code`= #{triggerCode}, `trigger_code`= #{triggerCode},
@ -151,7 +151,7 @@
</update> </update>
<update id="updateHandleInfo"> <update id="updateHandleInfo">
UPDATE XXL_JOB_LOG UPDATE xxl_job_log
SET SET
`handle_time`= #{handleTime}, `handle_time`= #{handleTime},
`handle_code`= #{handleCode}, `handle_code`= #{handleCode},
@ -160,13 +160,13 @@
</update> </update>
<delete id="delete" > <delete id="delete" >
delete from XXL_JOB_LOG delete from xxl_job_log
WHERE job_id = #{jobId} WHERE job_id = #{jobId}
</delete> </delete>
<select id="triggerCountByHandleCode" resultType="int" > <select id="triggerCountByHandleCode" resultType="int" >
SELECT count(1) SELECT count(1)
FROM XXL_JOB_LOG AS t FROM xxl_job_log AS t
<trim prefix="WHERE" prefixOverrides="AND | OR" > <trim prefix="WHERE" prefixOverrides="AND | OR" >
<if test="handleCode gt 0"> <if test="handleCode gt 0">
AND t.handle_code = #{handleCode} AND t.handle_code = #{handleCode}
@ -180,13 +180,13 @@
COUNT(handle_code) triggerDayCount, COUNT(handle_code) triggerDayCount,
SUM(CASE WHEN (trigger_code in (0, 200) and handle_code = 0) then 1 else 0 end) as triggerDayCountRunning, SUM(CASE WHEN (trigger_code in (0, 200) and handle_code = 0) then 1 else 0 end) as triggerDayCountRunning,
SUM(CASE WHEN handle_code = 200 then 1 else 0 end) as triggerDayCountSuc SUM(CASE WHEN handle_code = 200 then 1 else 0 end) as triggerDayCountSuc
FROM XXL_JOB_LOG FROM xxl_job_log
WHERE trigger_time BETWEEN #{from} and #{to} WHERE trigger_time BETWEEN #{from} and #{to}
GROUP BY triggerDay; GROUP BY triggerDay;
</select> </select>
<delete id="clearLog" > <delete id="clearLog" >
delete from XXL_JOB_LOG delete from xxl_job_log
<trim prefix="WHERE" prefixOverrides="AND | OR" > <trim prefix="WHERE" prefixOverrides="AND | OR" >
<if test="jobGroup gt 0"> <if test="jobGroup gt 0">
AND job_group = #{jobGroup} AND job_group = #{jobGroup}
@ -200,7 +200,7 @@
<if test="clearBeforeNum gt 0"> <if test="clearBeforeNum gt 0">
AND id NOT in( AND id NOT in(
SELECT id FROM( SELECT id FROM(
SELECT id FROM XXL_JOB_LOG AS t SELECT id FROM xxl_job_log AS t
<trim prefix="WHERE" prefixOverrides="AND | OR" > <trim prefix="WHERE" prefixOverrides="AND | OR" >
<if test="jobGroup gt 0"> <if test="jobGroup gt 0">
AND t.job_group = #{jobGroup} AND t.job_group = #{jobGroup}
@ -218,7 +218,7 @@
</delete> </delete>
<select id="findFailJobLogIds" resultType="int" > <select id="findFailJobLogIds" resultType="int" >
SELECT id FROM `XXL_JOB_LOG` SELECT id FROM `xxl_job_log`
WHERE !( WHERE !(
(trigger_code in (0, 200) and handle_code = 0) (trigger_code in (0, 200) and handle_code = 0)
OR OR
@ -229,7 +229,7 @@
</select> </select>
<update id="updateAlarmStatus" > <update id="updateAlarmStatus" >
UPDATE XXL_JOB_LOG UPDATE xxl_job_log
SET SET
`alarm_status` = #{newAlarmStatus} `alarm_status` = #{newAlarmStatus}
WHERE `id`= #{logId} AND `alarm_status` = #{oldAlarmStatus} WHERE `id`= #{logId} AND `alarm_status` = #{oldAlarmStatus}

@ -20,18 +20,18 @@
</sql> </sql>
<delete id="removeDead" parameterType="java.lang.Integer" > <delete id="removeDead" parameterType="java.lang.Integer" >
DELETE FROM XXL_JOB_REGISTRY DELETE FROM xxl_job_registry
WHERE update_time <![CDATA[ < ]]> DATE_ADD(NOW(),INTERVAL -#{timeout} SECOND) WHERE update_time <![CDATA[ < ]]> DATE_ADD(NOW(),INTERVAL -#{timeout} SECOND)
</delete> </delete>
<select id="findAll" parameterType="java.lang.Integer" resultMap="XxlJobRegistry"> <select id="findAll" parameterType="java.lang.Integer" resultMap="XxlJobRegistry">
SELECT <include refid="Base_Column_List" /> SELECT <include refid="Base_Column_List" />
FROM XXL_JOB_REGISTRY AS t FROM xxl_job_registry AS t
WHERE t.update_time <![CDATA[ > ]]> DATE_ADD(NOW(),INTERVAL -#{timeout} SECOND) WHERE t.update_time <![CDATA[ > ]]> DATE_ADD(NOW(),INTERVAL -#{timeout} SECOND)
</select> </select>
<update id="registryUpdate" > <update id="registryUpdate" >
UPDATE XXL_JOB_REGISTRY UPDATE xxl_job_registry
SET `update_time` = NOW() SET `update_time` = NOW()
WHERE `registry_group` = #{registryGroup} WHERE `registry_group` = #{registryGroup}
AND `registry_key` = #{registryKey} AND `registry_key` = #{registryKey}
@ -39,12 +39,12 @@
</update> </update>
<insert id="registrySave" > <insert id="registrySave" >
INSERT INTO XXL_JOB_REGISTRY( `registry_group` , `registry_key` , `registry_value`, `update_time`) INSERT INTO xxl_job_registry( `registry_group` , `registry_key` , `registry_value`, `update_time`)
VALUES( #{registryGroup} , #{registryKey} , #{registryValue}, NOW()) VALUES( #{registryGroup} , #{registryKey} , #{registryValue}, NOW())
</insert> </insert>
<delete id="registryDelete" > <delete id="registryDelete" >
DELETE FROM XXL_JOB_REGISTRY DELETE FROM xxl_job_registry
WHERE registry_group = #{registryGroup} WHERE registry_group = #{registryGroup}
AND registry_key = #{registryKey} AND registry_key = #{registryKey}
AND registry_value = #{registryValue} AND registry_value = #{registryValue}

@ -21,7 +21,7 @@
<select id="pageList" parameterType="java.util.HashMap" resultMap="XxlJobUser"> <select id="pageList" parameterType="java.util.HashMap" resultMap="XxlJobUser">
SELECT <include refid="Base_Column_List" /> SELECT <include refid="Base_Column_List" />
FROM XXL_JOB_USER AS t FROM xxl_job_user AS t
<trim prefix="WHERE" prefixOverrides="AND | OR" > <trim prefix="WHERE" prefixOverrides="AND | OR" >
<if test="username != null and username != ''"> <if test="username != null and username != ''">
AND t.username like CONCAT(CONCAT('%', #{username}), '%') AND t.username like CONCAT(CONCAT('%', #{username}), '%')
@ -36,7 +36,7 @@
<select id="pageListCount" parameterType="java.util.HashMap" resultType="int"> <select id="pageListCount" parameterType="java.util.HashMap" resultType="int">
SELECT count(1) SELECT count(1)
FROM XXL_JOB_USER AS t FROM xxl_job_user AS t
<trim prefix="WHERE" prefixOverrides="AND | OR" > <trim prefix="WHERE" prefixOverrides="AND | OR" >
<if test="username != null and username != ''"> <if test="username != null and username != ''">
AND t.username like CONCAT(CONCAT('%', #{username}), '%') AND t.username like CONCAT(CONCAT('%', #{username}), '%')
@ -49,12 +49,12 @@
<select id="loadByUserName" parameterType="java.util.HashMap" resultMap="XxlJobUser"> <select id="loadByUserName" parameterType="java.util.HashMap" resultMap="XxlJobUser">
SELECT <include refid="Base_Column_List" /> SELECT <include refid="Base_Column_List" />
FROM XXL_JOB_USER AS t FROM xxl_job_user AS t
WHERE t.username = #{username} WHERE t.username = #{username}
</select> </select>
<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobUser" useGeneratedKeys="true" keyProperty="id" > <insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobUser" useGeneratedKeys="true" keyProperty="id" >
INSERT INTO XXL_JOB_USER ( INSERT INTO xxl_job_user (
username, username,
password, password,
role, role,
@ -68,7 +68,7 @@
</insert> </insert>
<update id="update" parameterType="com.xxl.job.admin.core.model.XxlJobUser" > <update id="update" parameterType="com.xxl.job.admin.core.model.XxlJobUser" >
UPDATE XXL_JOB_USER UPDATE xxl_job_user
SET SET
<if test="password != null and password != ''"> <if test="password != null and password != ''">
password = #{password}, password = #{password},
@ -80,7 +80,7 @@
<delete id="delete" parameterType="java.util.HashMap"> <delete id="delete" parameterType="java.util.HashMap">
DELETE DELETE
FROM XXL_JOB_USER FROM xxl_job_user
WHERE id = #{id} WHERE id = #{id}
</delete> </delete>

Loading…
Cancel
Save