refactor(xxl-job): 升级xxl-job-admin 3.1.1

This commit is contained in:
PIG AI committed 2025-07-07 10:53:38 +08:00
1 parent 2fc40ac21a
commit fdc3ba87da
35 files changed
+285 -226

No files matched your search

@@ -21,6 +21,7 @@ import java.util.Map;
/**
* index controller
*
* @author xuxueli 2015-12-19 16:13:16
*/
@Controller
@@ -28,10 +29,10 @@ public class IndexController {
@Resource
private XxlJobService xxlJobService;
@Resource
private LoginService loginService;
@RequestMapping("/")
public String index(Model model) {
@@ -48,7 +49,7 @@ public class IndexController {
ReturnT<Map<String, Object>> chartInfo = xxlJobService.chartInfo(startDate, endDate);
return chartInfo;
}
@RequestMapping("/toLogin")
@PermissionLimit(limit = false)
public ModelAndView toLogin(HttpServletRequest request, HttpServletResponse response, ModelAndView modelAndView) {
@@ -21,6 +21,7 @@ import java.util.List;
/**
* job code controller
*
* @author xuxueli 2015-12-19 16:13:16
*/
@Controller
@@ -29,6 +30,7 @@ public class JobCodeController {
@Resource
private XxlJobInfoDao xxlJobInfoDao;
@Resource
private XxlJobLogGlueDao xxlJobLogGlueDao;
@@ -21,6 +21,7 @@ import java.util.*;
/**
* job group controller
*
* @author xuxueli 2016-10-02 20:52:56
*/
@Controller
@@ -29,8 +30,10 @@ public class JobGroupController {
@Resource
public XxlJobInfoDao xxlJobInfoDao;
@Resource
public XxlJobGroupDao xxlJobGroupDao;
@Resource
private XxlJobRegistryDao xxlJobRegistryDao;
@@ -33,15 +33,18 @@ import java.util.Map;
/**
* index controller
*
* @author xuxueli 2015-12-19 16:13:16
*/
@Controller
@RequestMapping("/jobinfo")
public class JobInfoController {
private static Logger logger = LoggerFactory.getLogger(JobInfoController.class);
@Resource
private XxlJobGroupDao xxlJobGroupDao;
@Resource
private XxlJobService xxlJobService;
@@ -78,7 +81,7 @@ public class JobInfoController {
@RequestParam("jobGroup") int jobGroup, @RequestParam("triggerStatus") int triggerStatus,
@RequestParam("jobDesc") String jobDesc, @RequestParam("executorHandler") String executorHandler,
@RequestParam("author") String author) {
return xxlJobService.pageList(start, length, jobGroup, triggerStatus, jobDesc, executorHandler, author);
}
@@ -36,17 +36,21 @@ import java.util.Map;
/**
* index controller
*
* @author xuxueli 2015-12-19 16:13:16
*/
@Controller
@RequestMapping("/joblog")
public class JobLogController {
private static Logger logger = LoggerFactory.getLogger(JobLogController.class);
@Resource
private XxlJobGroupDao xxlJobGroupDao;
@Resource
public XxlJobInfoDao xxlJobInfoDao;
@Resource
public XxlJobLogDao xxlJobLogDao;
@@ -100,7 +104,7 @@ public class JobLogController {
// valid permission
PermissionInterceptor.validJobGroupPermission(request, jobGroup); // 仅管理员支持查询全部;普通用户仅支持查询有权限的
// jobGroup
// parse param
Date triggerTimeStart = null;
Date triggerTimeEnd = null;
@@ -117,7 +121,7 @@ public class JobLogController {
logStatus);
int list_count = xxlJobLogDao.pageListCount(start, length, jobGroup, jobId, triggerTimeStart, triggerTimeEnd,
logStatus);
// package result
Map<String, Object> maps = new HashMap<String, Object>();
maps.put("recordsTotal", list_count); // 总记录数
@@ -1,6 +1,5 @@
package com.xxl.job.admin.controller.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
@@ -8,6 +7,7 @@ import java.lang.annotation.Target;
/**
* 权限限制
*
* @author xuxueli 2015-12-12 18:29:02
*/
@Target(ElementType.METHOD)
@@ -30,7 +30,7 @@ public class PermissionInterceptor implements AsyncHandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
throws Exception {
if (!(handler instanceof HandlerMethod)) {
return true; // proceed with the next interceptor
}
@@ -63,7 +63,6 @@ public class PermissionInterceptor implements AsyncHandlerInterceptor {
return true; // proceed with the next interceptor
}
// -------------------- permission tool --------------------
/**
@@ -130,5 +129,4 @@ public class PermissionInterceptor implements AsyncHandlerInterceptor {
return jobGroupList;
}
}
@@ -22,6 +22,7 @@ import java.io.IOException;
*/
@Component
public class WebExceptionResolver implements HandlerExceptionResolver {
private static transient Logger logger = LoggerFactory.getLogger(WebExceptionResolver.class);
@Override
@@ -1641,6 +1641,7 @@ public final class CronExpression implements Serializable, Cloneable {
public Object clone() {
return new CronExpression(this);
}
}
class ValueSet {
@@ -1648,4 +1649,5 @@ class ValueSet {
public int value;
public int pos;
}
@@ -12,9 +12,11 @@ public class XxlJobInfo {
private int id; // 主键ID
private int jobGroup; // 执行器主键ID
private String jobDesc;
private Date addTime;
private Date updateTime;
private String author; // 负责人
@@ -55,7 +57,6 @@ public class XxlJobInfo {
private long triggerNextTime; // 下次调度时间
public int getId() {
return id;
}
@@ -247,4 +248,5 @@ public class XxlJobInfo {
public void setTriggerNextTime(long triggerNextTime) {
this.triggerNextTime = triggerNextTime;
}
}
@@ -13,23 +13,32 @@ public class XxlJobLog {
// job info
private int jobGroup;
private int jobId;
// execute info
private String executorAddress;
private String executorHandler;
private String executorParam;
private String executorShardingParam;
private int executorFailRetryCount;
// trigger info
private Date triggerTime;
private int triggerCode;
private String triggerMsg;
// handle info
private Date handleTime;
private int handleCode;
private String handleMsg;
// alarm info
@@ -4,6 +4,7 @@ import java.util.Date;
/**
* xxl-job log for glue, used to track job code process
*
* @author xuxueli 2016-5-19 17:57:46
*/
public class XxlJobLogGlue {
@@ -13,9 +14,13 @@ public class XxlJobLogGlue {
private int jobId; // 任务主键ID
private String glueType; // GLUE类型 #com.xxl.job.core.glue.GlueTypeEnum
private String glueSource;
private String glueRemark;
private Date addTime;
private Date updateTime;
public int getId() {
@@ -53,4 +53,5 @@ public class XxlJobLogReport {
public void setFailCount(int failCount) {
this.failCount = failCount;
}
}
@@ -56,4 +56,5 @@ public class XxlJobRegistry {
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
@@ -49,4 +49,5 @@ public class ExecutorRouteFailover extends ExecutorRouter {
return new ReturnT<String>(ReturnT.FAIL_CODE, beatResultSB.toString());
}
}
@@ -20,6 +20,7 @@ import java.util.concurrent.*;
* @author xuxueli 2015-9-1 18:05:56
*/
public class JobCompleteHelper {
private static Logger logger = LoggerFactory.getLogger(JobCompleteHelper.class);
private static JobCompleteHelper instance = new JobCompleteHelper();
@@ -31,7 +32,9 @@ public class JobCompleteHelper {
// ---------------------- monitor ----------------------
private ThreadPoolExecutor callbackThreadPool = null;
private Thread monitorThread;
private volatile boolean toStop = false;
public void start() {
@@ -52,7 +55,6 @@ public class JobCompleteHelper {
}
});
// for monitor
monitorThread = new Thread(new Runnable() {
@@ -135,7 +137,6 @@ public class JobCompleteHelper {
}
}
// ---------------------- helper ----------------------
public ReturnT<String> callback(List<HandleCallbackParam> callbackParamList) {
@@ -189,5 +190,4 @@ public class JobCompleteHelper {
return ReturnT.SUCCESS;
}
}
@@ -17,6 +17,7 @@ import java.util.concurrent.TimeUnit;
* @author xuxueli 2015-9-1 18:05:56
*/
public class JobFailMonitorHelper {
private static Logger logger = LoggerFactory.getLogger(JobFailMonitorHelper.class);
private static JobFailMonitorHelper instance = new JobFailMonitorHelper();
@@ -28,6 +29,7 @@ public class JobFailMonitorHelper {
// ---------------------- monitor ----------------------
private Thread monitorThread;
private volatile boolean toStop = false;
public void start() {
@@ -15,6 +15,7 @@ import java.util.concurrent.*;
/**
* job registry instance
*
* @author xuxueli 2016-10-02 19:10:24
*/
public class JobRegistryHelper {
@@ -22,8 +23,11 @@ public class JobRegistryHelper {
private static Logger logger = LoggerFactory.getLogger(JobRegistryHelper.class);
private static JobRegistryHelper instance = new JobRegistryHelper();
private ThreadPoolExecutor registryOrRemoveThreadPool = null;
private Thread registryMonitorThread;
private volatile boolean toStop = false;
public static JobRegistryHelper getInstance() {
@@ -221,5 +225,4 @@ public class JobRegistryHelper {
// Under consideration, prevent affecting core tables
}
}
@@ -57,7 +57,6 @@ public class JobTriggerPoolHelper {
});
}
public void stop() {
// triggerPool.shutdown();
fastTriggerPool.shutdownNow();
@@ -13,6 +13,7 @@ public class CookieUtil {
// 默认缓存时间,单位/秒, 2H
private static final int COOKIE_MAX_AGE = Integer.MAX_VALUE;
// 保存路径,根路径
private static final String COOKIE_PATH = "/";
@@ -18,6 +18,7 @@ import java.io.IOException;
* @author xuxueli 2015-9-25 18:02:56
*/
public class JacksonUtil {
private static Logger logger = LoggerFactory.getLogger(JacksonUtil.class);
private final static ObjectMapper objectMapper = new ObjectMapper();
@@ -95,4 +96,5 @@ public class JacksonUtil {
}
return null;
}
}
@@ -55,7 +55,6 @@ public class LocalCacheUtil {
}
/**
* set cache
* @param key
@@ -6,9 +6,9 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* job info
*
* @author xuxueli 2016-1-12 18:03:45
*/
@Mapper
@@ -23,7 +23,7 @@ public interface XxlJobInfoDao {
@Param("jobGroup") int jobGroup, @Param("triggerStatus") int triggerStatus,
@Param("jobDesc") String jobDesc, @Param("executorHandler") String executorHandler,
@Param("author") String author);
public int save(XxlJobInfo info);
public XxlJobInfo loadById(@Param("id") int id);
@@ -54,5 +54,4 @@ public interface XxlJobInfoDao {
*/
public int scheduleUpdate(XxlJobInfo xxlJobInfo);
}
@@ -10,6 +10,7 @@ import java.util.Map;
/**
* job log
*
* @author xuxueli 2016-1-12 18:03:06
*/
@Mapper
@@ -25,7 +26,7 @@ public interface XxlJobLogDao {
@Param("jobGroup") int jobGroup, @Param("jobId") int jobId,
@Param("triggerTimeStart") Date triggerTimeStart, @Param("triggerTimeEnd") Date triggerTimeEnd,
@Param("logStatus") int logStatus);
public XxlJobLog load(@Param("id") long id);
public long save(XxlJobLog xxlJobLog);
@@ -41,6 +42,7 @@ public interface XxlJobLogDao {
public List<Long> findClearLogIds(@Param("jobGroup") int jobGroup, @Param("jobId") int jobId,
@Param("clearBeforeTime") Date clearBeforeTime, @Param("clearBeforeNum") int clearBeforeNum,
@Param("pagesize") int pagesize);
public int clearLog(@Param("logIds") List<Long> logIds);
public List<Long> findFailJobLogIds(@Param("pagesize") int pagesize);
@@ -8,6 +8,7 @@ import java.util.List;
/**
* job log for glue
*
* @author xuxueli 2016-5-19 18:04:56
*/
@Mapper
@@ -9,6 +9,7 @@ import java.util.List;
/**
* job log
*
* @author xuxueli 2019-11-22
*/
@Mapper
@@ -1,6 +1,5 @@
package com.xxl.job.admin.service;
import com.xxl.job.admin.core.model.XxlJobInfo;
import com.xxl.job.admin.core.model.XxlJobUser;
import com.xxl.job.core.biz.model.ReturnT;
@@ -106,5 +106,4 @@ public class LoginService {
return null;
}
}
@@ -28,20 +28,26 @@ import java.util.*;
/**
* core job action for xxl-job
*
* @author xuxueli 2016-5-28 15:30:33
*/
@Service
public class XxlJobServiceImpl implements XxlJobService {
private static Logger logger = LoggerFactory.getLogger(XxlJobServiceImpl.class);
@Resource
private XxlJobGroupDao xxlJobGroupDao;
@Resource
private XxlJobInfoDao xxlJobInfoDao;
@Resource
public XxlJobLogDao xxlJobLogDao;
@Resource
private XxlJobLogGlueDao xxlJobLogGlueDao;
@Resource
private XxlJobLogReportDao xxlJobLogReportDao;
@@ -54,7 +60,7 @@ public class XxlJobServiceImpl implements XxlJobService {
author);
int list_count = xxlJobInfoDao.pageListCount(start, length, jobGroup, triggerStatus, jobDesc, executorHandler,
author);
// package result
Map<String, Object> maps = new HashMap<String, Object>();
maps.put("recordsTotal", list_count); // 总记录数
@@ -357,7 +363,6 @@ public class XxlJobServiceImpl implements XxlJobService {
exists_jobInfo.setUpdateTime(new Date());
xxlJobInfoDao.update(exists_jobInfo);
return ReturnT.SUCCESS;
}
@@ -432,7 +437,6 @@ public class XxlJobServiceImpl implements XxlJobService {
return ReturnT.SUCCESS;
}
@Override
public ReturnT<String> trigger(XxlJobUser loginUser, int jobId, String executorParam, String addressList) {
// permission
@@ -3,13 +3,13 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xxl.job.admin.dao.XxlJobGroupDao">
<resultMap id="XxlJobGroup" type="com.xxl.job.admin.core.model.XxlJobGroup" >
<result column="id" property="id" />
<resultMap id="XxlJobGroup" type="com.xxl.job.admin.core.model.XxlJobGroup">
<result column="id" property="id"/>
<result column="app_name" property="appname"/>
<result column="title" property="title"/>
<result column="address_type" property="addressType" />
<result column="address_list" property="addressList" />
<result column="update_time" property="updateTime" />
<result column="address_type" property="addressType"/>
<result column="address_list" property="addressList"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<sql id="Base_Column_List">
@@ -22,24 +22,26 @@
</sql>
<select id="findAll" resultMap="XxlJobGroup">
SELECT <include refid="Base_Column_List" />
SELECT
<include refid="Base_Column_List"/>
FROM xxl_job_group AS t
ORDER BY t.app_name, t.title, t.id ASC
</select>
<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
WHERE t.address_type = #{addressType}
ORDER BY t.app_name, t.title, t.id ASC
</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`, `address_type`, `address_list`, `update_time`)
values ( #{appname}, #{title}, #{addressType}, #{addressList}, #{updateTime} );
</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
SET `app_name` = #{appname},
`title` = #{title},
@@ -49,21 +51,23 @@
WHERE id = #{id}
</update>
<delete id="remove" parameterType="java.lang.Integer" >
<delete id="remove" parameterType="java.lang.Integer">
DELETE FROM xxl_job_group
WHERE id = #{id}
</delete>
<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
WHERE t.id = #{id}
</select>
<select id="pageList" parameterType="java.util.HashMap" resultMap="XxlJobGroup">
SELECT <include refid="Base_Column_List" />
SELECT
<include refid="Base_Column_List"/>
FROM xxl_job_group AS t
<trim prefix="WHERE" prefixOverrides="AND | OR" >
<trim prefix="WHERE" prefixOverrides="AND | OR">
<if test="appname != null and appname != ''">
AND t.app_name like CONCAT(CONCAT('%', #{appname}), '%')
</if>
@@ -78,7 +82,7 @@
<select id="pageListCount" parameterType="java.util.HashMap" resultType="int">
SELECT count(1)
FROM xxl_job_group AS t
<trim prefix="WHERE" prefixOverrides="AND | OR" >
<trim prefix="WHERE" prefixOverrides="AND | OR">
<if test="appname != null and appname != ''">
AND t.app_name like CONCAT(CONCAT('%', #{appname}), '%')
</if>
@@ -1,41 +1,41 @@
<?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">
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xxl.job.admin.dao.XxlJobInfoDao">
<resultMap id="XxlJobInfo" type="com.xxl.job.admin.core.model.XxlJobInfo" >
<result column="id" property="id" />
<resultMap id="XxlJobInfo" type="com.xxl.job.admin.core.model.XxlJobInfo">
<result column="id" property="id"/>
<result column="job_group" property="jobGroup" />
<result column="job_desc" property="jobDesc" />
<result column="job_group" property="jobGroup"/>
<result column="job_desc" property="jobDesc"/>
<result column="add_time" property="addTime" />
<result column="update_time" property="updateTime" />
<result column="add_time" property="addTime"/>
<result column="update_time" property="updateTime"/>
<result column="author" property="author" />
<result column="alarm_email" property="alarmEmail" />
<result column="author" property="author"/>
<result column="alarm_email" property="alarmEmail"/>
<result column="schedule_type" property="scheduleType" />
<result column="schedule_conf" property="scheduleConf" />
<result column="misfire_strategy" property="misfireStrategy" />
<result column="schedule_type" property="scheduleType"/>
<result column="schedule_conf" property="scheduleConf"/>
<result column="misfire_strategy" property="misfireStrategy"/>
<result column="executor_route_strategy" property="executorRouteStrategy" />
<result column="executor_handler" property="executorHandler" />
<result column="executor_param" property="executorParam" />
<result column="executor_block_strategy" property="executorBlockStrategy" />
<result column="executor_timeout" property="executorTimeout" />
<result column="executor_fail_retry_count" property="executorFailRetryCount" />
<result column="executor_route_strategy" property="executorRouteStrategy"/>
<result column="executor_handler" property="executorHandler"/>
<result column="executor_param" property="executorParam"/>
<result column="executor_block_strategy" property="executorBlockStrategy"/>
<result column="executor_timeout" property="executorTimeout"/>
<result column="executor_fail_retry_count" property="executorFailRetryCount"/>
<result column="glue_type" property="glueType" />
<result column="glue_source" property="glueSource" />
<result column="glue_remark" property="glueRemark" />
<result column="glue_updatetime" property="glueUpdatetime" />
<result column="glue_type" property="glueType"/>
<result column="glue_source" property="glueSource"/>
<result column="glue_remark" property="glueRemark"/>
<result column="glue_updatetime" property="glueUpdatetime"/>
<result column="child_jobid" property="childJobId" />
<result column="child_jobid" property="childJobId"/>
<result column="trigger_status" property="triggerStatus" />
<result column="trigger_last_time" property="triggerLastTime" />
<result column="trigger_next_time" property="triggerNextTime" />
<result column="trigger_status" property="triggerStatus"/>
<result column="trigger_last_time" property="triggerLastTime"/>
<result column="trigger_next_time" property="triggerNextTime"/>
</resultMap>
<sql id="Base_Column_List">
@@ -66,9 +66,10 @@
</sql>
<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
<trim prefix="WHERE" prefixOverrides="AND | OR" >
<trim prefix="WHERE" prefixOverrides="AND | OR">
<if test="jobGroup gt 0">
AND t.job_group = #{jobGroup}
</if>
@@ -92,7 +93,7 @@
<select id="pageListCount" parameterType="java.util.HashMap" resultType="int">
SELECT count(1)
FROM xxl_job_info AS t
<trim prefix="WHERE" prefixOverrides="AND | OR" >
<trim prefix="WHERE" prefixOverrides="AND | OR">
<if test="jobGroup gt 0">
AND t.job_group = #{jobGroup}
</if>
@@ -111,93 +112,94 @@
</trim>
</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 (
job_group,
job_desc,
add_time,
update_time,
author,
alarm_email,
schedule_type,
schedule_conf,
misfire_strategy,
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,
trigger_status,
trigger_last_time,
trigger_next_time
job_group,
job_desc,
add_time,
update_time,
author,
alarm_email,
schedule_type,
schedule_conf,
misfire_strategy,
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,
trigger_status,
trigger_last_time,
trigger_next_time
) VALUES (
#{jobGroup},
#{jobDesc},
#{addTime},
#{updateTime},
#{author},
#{alarmEmail},
#{scheduleType},
#{scheduleConf},
#{misfireStrategy},
#{executorRouteStrategy},
#{executorHandler},
#{executorParam},
#{executorBlockStrategy},
#{executorTimeout},
#{executorFailRetryCount},
#{glueType},
#{glueSource},
#{glueRemark},
#{glueUpdatetime},
#{childJobId},
#{triggerStatus},
#{triggerLastTime},
#{triggerNextTime}
#{jobGroup},
#{jobDesc},
#{addTime},
#{updateTime},
#{author},
#{alarmEmail},
#{scheduleType},
#{scheduleConf},
#{misfireStrategy},
#{executorRouteStrategy},
#{executorHandler},
#{executorParam},
#{executorBlockStrategy},
#{executorTimeout},
#{executorFailRetryCount},
#{glueType},
#{glueSource},
#{glueRemark},
#{glueUpdatetime},
#{childJobId},
#{triggerStatus},
#{triggerLastTime},
#{triggerNextTime}
);
<!--<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
SELECT LAST_INSERT_ID()
/*SELECT @@IDENTITY AS id*/
</selectKey>-->
SELECT LAST_INSERT_ID()
/*SELECT @@IDENTITY AS id*/
</selectKey>-->
</insert>
<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
WHERE t.id = #{id}
</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
SET
job_group = #{jobGroup},
job_desc = #{jobDesc},
update_time = #{updateTime},
author = #{author},
alarm_email = #{alarmEmail},
schedule_type = #{scheduleType},
schedule_conf = #{scheduleConf},
misfire_strategy = #{misfireStrategy},
executor_route_strategy = #{executorRouteStrategy},
executor_handler = #{executorHandler},
executor_param = #{executorParam},
executor_block_strategy = #{executorBlockStrategy},
job_group = #{jobGroup},
job_desc = #{jobDesc},
update_time = #{updateTime},
author = #{author},
alarm_email = #{alarmEmail},
schedule_type = #{scheduleType},
schedule_conf = #{scheduleConf},
misfire_strategy = #{misfireStrategy},
executor_route_strategy = #{executorRouteStrategy},
executor_handler = #{executorHandler},
executor_param = #{executorParam},
executor_block_strategy = #{executorBlockStrategy},
executor_timeout = #{executorTimeout},
executor_fail_retry_count = #{executorFailRetryCount},
glue_type = #{glueType},
glue_source = #{glueSource},
glue_remark = #{glueRemark},
glue_updatetime = #{glueUpdatetime},
child_jobid = #{childJobId},
trigger_status = #{triggerStatus},
trigger_last_time = #{triggerLastTime},
trigger_next_time = #{triggerNextTime}
glue_type = #{glueType},
glue_source = #{glueSource},
glue_remark = #{glueRemark},
glue_updatetime = #{glueUpdatetime},
child_jobid = #{childJobId},
trigger_status = #{triggerStatus},
trigger_last_time = #{triggerLastTime},
trigger_next_time = #{triggerNextTime}
WHERE id = #{id}
</update>
@@ -208,7 +210,8 @@
</delete>
<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
WHERE t.job_group = #{jobGroup}
</select>
@@ -220,18 +223,19 @@
<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
WHERE t.trigger_status = 1
and t.trigger_next_time <![CDATA[ <= ]]> #{maxNextTime}
and t.trigger_next_time <![CDATA[ <= ]]> #{maxNextTime}
ORDER BY id ASC
LIMIT #{pagesize}
</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
SET
trigger_last_time = #{triggerLastTime},
trigger_last_time = #{triggerLastTime},
trigger_next_time = #{triggerNextTime}
<if test="triggerStatus gte 0">
, trigger_status = #{triggerStatus}
@@ -3,57 +3,59 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xxl.job.admin.dao.XxlJobLogGlueDao">
<resultMap id="XxlJobLogGlue" type="com.xxl.job.admin.core.model.XxlJobLogGlue" >
<result column="id" property="id" />
<resultMap id="XxlJobLogGlue" type="com.xxl.job.admin.core.model.XxlJobLogGlue">
<result column="id" property="id"/>
<result column="job_id" property="jobId"/>
<result column="glue_type" property="glueType" />
<result column="glue_type" property="glueType"/>
<result column="glue_source" property="glueSource"/>
<result column="glue_remark" property="glueRemark"/>
<result column="add_time" property="addTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
</resultMap>
<sql id="Base_Column_List">
t.id,
t.job_id,
t.glue_type,
t.glue_source,
t.glue_remark,
t.add_time,
t.update_time
</sql>
<sql id="Base_Column_List">
t.id,
t.job_id,
t.glue_type,
t.glue_source,
t.glue_remark,
t.add_time,
t.update_time
</sql>
<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobLogGlue" useGeneratedKeys="true" keyProperty="id" >
INSERT INTO xxl_job_logglue (
<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobLogGlue" useGeneratedKeys="true"
keyProperty="id">
INSERT INTO xxl_job_logglue (
`job_id`,
`glue_type`,
`glue_source`,
`glue_remark`,
`add_time`,
`update_time`
) VALUES (
) VALUES (
#{jobId},
#{glueType},
#{glueSource},
#{glueRemark},
#{addTime},
#{updateTime}
);
<!--<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
SELECT LAST_INSERT_ID()
</selectKey>-->
</insert>
);
<!--<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
SELECT LAST_INSERT_ID()
</selectKey>-->
</insert>
<select id="findByJobId" parameterType="java.lang.Integer" resultMap="XxlJobLogGlue">
SELECT <include refid="Base_Column_List" />
FROM xxl_job_logglue AS t
WHERE t.job_id = #{jobId}
ORDER BY id DESC
</select>
SELECT
<include refid="Base_Column_List"/>
FROM xxl_job_logglue AS t
WHERE t.job_id = #{jobId}
ORDER BY id DESC
</select>
<delete id="removeOld" >
DELETE FROM xxl_job_logglue
WHERE id NOT in(
<delete id="removeOld">
DELETE FROM xxl_job_logglue
WHERE id NOT in(
SELECT id FROM(
SELECT id FROM xxl_job_logglue
WHERE `job_id` = #{jobId}
@@ -61,11 +63,11 @@
LIMIT 0, #{limit}
) t1
) AND `job_id` = #{jobId}
</delete>
</delete>
<delete id="deleteByJobId" parameterType="java.lang.Integer" >
DELETE FROM xxl_job_logglue
<delete id="deleteByJobId" parameterType="java.lang.Integer">
DELETE FROM xxl_job_logglue
WHERE `job_id` = #{jobId}
</delete>
</delete>
</mapper>
@@ -3,17 +3,17 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xxl.job.admin.dao.XxlJobLogDao">
<resultMap id="XxlJobLog" type="com.xxl.job.admin.core.model.XxlJobLog" >
<result column="id" property="id" />
<resultMap id="XxlJobLog" type="com.xxl.job.admin.core.model.XxlJobLog">
<result column="id" property="id"/>
<result column="job_group" property="jobGroup" />
<result column="job_id" property="jobId" />
<result column="job_group" property="jobGroup"/>
<result column="job_id" property="jobId"/>
<result column="executor_address" property="executorAddress" />
<result column="executor_handler" property="executorHandler" />
<result column="executor_address" property="executorAddress"/>
<result column="executor_handler" property="executorHandler"/>
<result column="executor_param" property="executorParam"/>
<result column="executor_sharding_param" property="executorShardingParam" />
<result column="executor_fail_retry_count" property="executorFailRetryCount" />
<result column="executor_sharding_param" property="executorShardingParam"/>
<result column="executor_fail_retry_count" property="executorFailRetryCount"/>
<result column="trigger_time" property="triggerTime"/>
<result column="trigger_code" property="triggerCode"/>
@@ -23,7 +23,7 @@
<result column="handle_code" property="handleCode"/>
<result column="handle_msg" property="handleMsg"/>
<result column="alarm_status" property="alarmStatus" />
<result column="alarm_status" property="alarmStatus"/>
</resultMap>
<sql id="Base_Column_List">
@@ -45,9 +45,10 @@
</sql>
<select id="pageList" resultMap="XxlJobLog">
SELECT <include refid="Base_Column_List" />
SELECT
<include refid="Base_Column_List"/>
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">
AND t.job_group = #{jobGroup}
</if>
@@ -60,16 +61,16 @@
<if test="triggerTimeEnd != null">
AND t.trigger_time <![CDATA[ <= ]]> #{triggerTimeEnd}
</if>
<if test="logStatus == 1" >
<if test="logStatus == 1">
AND t.handle_code = 200
</if>
<if test="logStatus == 2" >
<if test="logStatus == 2">
AND (
t.trigger_code NOT IN (0, 200) OR
t.handle_code NOT IN (0, 200)
)
</if>
<if test="logStatus == 3" >
<if test="logStatus == 3">
AND t.trigger_code = 200
AND t.handle_code = 0
</if>
@@ -81,7 +82,7 @@
<select id="pageListCount" resultType="int">
SELECT count(1)
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">
AND t.job_group = #{jobGroup}
</if>
@@ -94,16 +95,16 @@
<if test="triggerTimeEnd != null">
AND t.trigger_time <![CDATA[ <= ]]> #{triggerTimeEnd}
</if>
<if test="logStatus == 1" >
<if test="logStatus == 1">
AND t.handle_code = 200
</if>
<if test="logStatus == 2" >
<if test="logStatus == 2">
AND (
t.trigger_code NOT IN (0, 200) OR
t.handle_code NOT IN (0, 200)
)
</if>
<if test="logStatus == 3" >
<if test="logStatus == 3">
AND t.trigger_code = 200
AND t.handle_code = 0
</if>
@@ -111,13 +112,14 @@
</select>
<select id="load" parameterType="java.lang.Long" resultMap="XxlJobLog">
SELECT <include refid="Base_Column_List" />
SELECT
<include refid="Base_Column_List"/>
FROM xxl_job_log AS t
WHERE t.id = #{id}
</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 (
`job_group`,
`job_id`,
@@ -132,11 +134,11 @@
#{handleCode}
);
<!--<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
SELECT LAST_INSERT_ID()
</selectKey>-->
SELECT LAST_INSERT_ID()
</selectKey>-->
</insert>
<update id="updateTriggerInfo" >
<update id="updateTriggerInfo">
UPDATE xxl_job_log
SET
`trigger_time`= #{triggerTime},
@@ -159,7 +161,7 @@
WHERE `id`= #{id}
</update>
<delete id="delete" >
<delete id="delete">
delete from xxl_job_log
WHERE job_id = #{jobId}
</delete>
@@ -185,9 +187,9 @@
WHERE trigger_time BETWEEN #{from} and #{to}
</select>
<select id="findClearLogIds" resultType="long" >
<select id="findClearLogIds" resultType="long">
SELECT id FROM xxl_job_log
<trim prefix="WHERE" prefixOverrides="AND | OR" >
<trim prefix="WHERE" prefixOverrides="AND | OR">
<if test="jobGroup gt 0">
AND job_group = #{jobGroup}
</if>
@@ -201,7 +203,7 @@
AND id NOT in(
SELECT id FROM(
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">
AND t.job_group = #{jobGroup}
</if>
@@ -219,15 +221,15 @@
LIMIT #{pagesize}
</select>
<delete id="clearLog" >
<delete id="clearLog">
delete from xxl_job_log
WHERE id in
<foreach collection="logIds" item="item" open="(" close=")" separator="," >
<foreach collection="logIds" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</delete>
<select id="findFailJobLogIds" resultType="long" >
<select id="findFailJobLogIds" resultType="long">
SELECT id FROM `xxl_job_log`
WHERE !(
(trigger_code in (0, 200) and handle_code = 0)
@@ -239,14 +241,14 @@
LIMIT #{pagesize}
</select>
<update id="updateAlarmStatus" >
<update id="updateAlarmStatus">
UPDATE xxl_job_log
SET
`alarm_status` = #{newAlarmStatus}
WHERE `id`= #{logId} AND `alarm_status` = #{oldAlarmStatus}
</update>
<select id="findLostJobIds" resultType="long" >
<select id="findLostJobIds" resultType="long">
SELECT
t.id
FROM
@@ -3,10 +3,10 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xxl.job.admin.dao.XxlJobLogReportDao">
<resultMap id="XxlJobLogReport" type="com.xxl.job.admin.core.model.XxlJobLogReport" >
<result column="id" property="id" />
<resultMap id="XxlJobLogReport" type="com.xxl.job.admin.core.model.XxlJobLogReport">
<result column="id" property="id"/>
<result column="trigger_day" property="triggerDay"/>
<result column="running_count" property="runningCount" />
<result column="running_count" property="runningCount"/>
<result column="suc_count" property="sucCount"/>
<result column="fail_count" property="failCount"/>
</resultMap>
@@ -19,7 +19,8 @@
t.fail_count
</sql>
<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobLogReport" useGeneratedKeys="true" keyProperty="id" >
<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobLogReport" useGeneratedKeys="true"
keyProperty="id">
INSERT INTO xxl_job_log_report (
`trigger_day`,
`running_count`,
@@ -32,11 +33,11 @@
#{failCount}
);
<!--<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
SELECT LAST_INSERT_ID()
</selectKey>-->
SELECT LAST_INSERT_ID()
</selectKey>-->
</insert>
<update id="update" >
<update id="update">
UPDATE xxl_job_log_report
SET `running_count` = #{runningCount},
`suc_count` = #{sucCount},
@@ -45,7 +46,8 @@
</update>
<select id="queryLogReport" resultMap="XxlJobLogReport">
SELECT <include refid="Base_Column_List" />
SELECT
<include refid="Base_Column_List"/>
FROM xxl_job_log_report AS t
WHERE t.trigger_day between #{triggerDayFrom} and #{triggerDayTo}
ORDER BY t.trigger_day ASC
@@ -3,12 +3,12 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xxl.job.admin.dao.XxlJobRegistryDao">
<resultMap id="XxlJobRegistry" type="com.xxl.job.admin.core.model.XxlJobRegistry" >
<result column="id" property="id" />
<resultMap id="XxlJobRegistry" type="com.xxl.job.admin.core.model.XxlJobRegistry">
<result column="id" property="id"/>
<result column="registry_group" property="registryGroup"/>
<result column="registry_key" property="registryKey"/>
<result column="registry_value" property="registryValue"/>
<result column="update_time" property="updateTime" />
<result column="update_time" property="updateTime"/>
</resultMap>
<sql id="Base_Column_List">
@@ -19,22 +19,23 @@
t.update_time
</sql>
<select id="findDead" parameterType="java.util.HashMap" resultType="java.lang.Integer" >
<select id="findDead" parameterType="java.util.HashMap" resultType="java.lang.Integer">
SELECT t.id
FROM xxl_job_registry AS t
WHERE t.update_time <![CDATA[ < ]]> DATE_ADD(#{nowTime},INTERVAL -#{timeout} SECOND)
</select>
<delete id="removeDead" parameterType="java.lang.Integer" >
<delete id="removeDead" parameterType="java.lang.Integer">
DELETE FROM xxl_job_registry
WHERE id in
<foreach collection="ids" item="item" open="(" close=")" separator="," >
<foreach collection="ids" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</delete>
<select id="findAll" parameterType="java.util.HashMap" resultMap="XxlJobRegistry">
SELECT <include refid="Base_Column_List" />
SELECT
<include refid="Base_Column_List"/>
FROM xxl_job_registry AS t
WHERE t.update_time <![CDATA[ > ]]> DATE_ADD(#{nowTime},INTERVAL -#{timeout} SECOND)
</select>
@@ -61,7 +62,7 @@
</insert>
-->
<delete id="registryDelete" >
<delete id="registryDelete">
DELETE FROM xxl_job_registry
WHERE registry_group = #{registryGroup}
AND registry_key = #{registryKey}