parent
3b4067a7b5
commit
ffe0ae7948
@ -0,0 +1,94 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xxl.job.admin.dao.XxlJobGroupDao">
|
||||
|
||||
<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" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
t.id,
|
||||
t.app_name,
|
||||
t.title,
|
||||
t.address_type,
|
||||
t.address_list
|
||||
</sql>
|
||||
|
||||
<sql id='XXL_JOB_GROUP_ID'>XXL_JOB_GROUP_ID.NEXTVAL</sql>
|
||||
|
||||
<select id="findAll" resultMap="XxlJobGroup">
|
||||
SELECT <include refid="Base_Column_List" />
|
||||
FROM xxl_job_group 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" />
|
||||
FROM xxl_job_group 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" >
|
||||
<selectKey keyProperty="id" resultType="int" order="BEFORE">
|
||||
select <include refid="XXL_JOB_GROUP_ID" /> from dual
|
||||
</selectKey>
|
||||
INSERT INTO xxl_job_group (id, app_name, title, address_type, address_list)
|
||||
values ( #{id},#{appname,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, #{addressType}, #{addressList,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.xxl.job.admin.core.model.XxlJobGroup" >
|
||||
UPDATE xxl_job_group
|
||||
SET app_name = #{appname,jdbcType=VARCHAR},
|
||||
title = #{title,jdbcType=VARCHAR},
|
||||
address_type = #{addressType},
|
||||
address_list = #{addressList,jdbcType=VARCHAR}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<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" />
|
||||
FROM xxl_job_group t
|
||||
WHERE t.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="pageList" parameterType="java.util.HashMap" resultMap="XxlJobGroup">
|
||||
select * from (
|
||||
SELECT row_number() over(ORDER BY t.app_name, t.title, t.id ASC) r,<include refid="Base_Column_List"/>
|
||||
FROM xxl_job_group t
|
||||
<trim prefix="WHERE" prefixOverrides="AND | OR">
|
||||
<if test="appname != null and appname != ''">
|
||||
AND t.app_name like CONCAT(CONCAT('%', #{appname}), '%')
|
||||
</if>
|
||||
<if test="title != null and title != ''">
|
||||
AND t.title like CONCAT(CONCAT('%', #{title}), '%')
|
||||
</if>
|
||||
</trim>
|
||||
)
|
||||
where r between #{offset}+1 and #{offset}+#{pagesize}
|
||||
</select>
|
||||
|
||||
<select id="pageListCount" parameterType="java.util.HashMap" resultType="int">
|
||||
SELECT count(1)
|
||||
FROM xxl_job_group t
|
||||
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
||||
<if test="appname != null and appname != ''">
|
||||
AND t.app_name like CONCAT(CONCAT('%', #{appname}), '%')
|
||||
</if>
|
||||
<if test="title != null and title != ''">
|
||||
AND t.title like CONCAT(CONCAT('%', #{title}), '%')
|
||||
</if>
|
||||
</trim>
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,237 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xxl.job.admin.dao.XxlJobInfoDao">
|
||||
|
||||
<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_cron" property="jobCron" />
|
||||
<result column="job_desc" property="jobDesc" />
|
||||
|
||||
<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="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="child_jobid" property="childJobId" />
|
||||
|
||||
<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">
|
||||
t.id,
|
||||
t.job_group,
|
||||
t.job_cron,
|
||||
t.job_desc,
|
||||
t.add_time,
|
||||
t.update_time,
|
||||
t.author,
|
||||
t.alarm_email,
|
||||
t.executor_route_strategy,
|
||||
t.executor_handler,
|
||||
t.executor_param,
|
||||
t.executor_block_strategy,
|
||||
t.executor_timeout,
|
||||
t.executor_fail_retry_count,
|
||||
t.glue_type,
|
||||
t.glue_source,
|
||||
t.glue_remark,
|
||||
t.glue_updatetime,
|
||||
t.child_jobid,
|
||||
t.trigger_status,
|
||||
t.trigger_last_time,
|
||||
t.trigger_next_time
|
||||
</sql>
|
||||
|
||||
<sql id='XXL_JOB_INFO_ID'>XXL_JOB_INFO_ID.NEXTVAL</sql>
|
||||
|
||||
<select id="pageList" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
|
||||
select * from (
|
||||
SELECT row_number() over(ORDER BY id DESC) r,<include refid="Base_Column_List"/>
|
||||
FROM xxl_job_info t
|
||||
<trim prefix="WHERE" prefixOverrides="AND | OR">
|
||||
<if test="jobGroup gt 0">
|
||||
AND t.job_group = #{jobGroup}
|
||||
</if>
|
||||
<if test="triggerStatus gte 0">AND t.trigger_status = #{triggerStatus}
|
||||
</if>
|
||||
<if test="jobDesc != null and jobDesc != ''">
|
||||
AND t.job_desc like CONCAT(CONCAT('%', #{jobDesc,jdbcType=VARCHAR}), '%')
|
||||
</if>
|
||||
<if test="executorHandler != null and executorHandler != ''">
|
||||
AND t.executor_handler like CONCAT(CONCAT('%', #{executorHandler,jdbcType=VARCHAR}), '%')
|
||||
</if>
|
||||
<if test="author != null and author != ''">
|
||||
AND t.author like CONCAT(CONCAT('%', #{author,jdbcType=VARCHAR}), '%')
|
||||
</if>
|
||||
</trim>
|
||||
)
|
||||
where r between #{offset}+1 and #{offset}+#{pagesize}
|
||||
</select>
|
||||
|
||||
<select id="pageListCount" parameterType="java.util.HashMap" resultType="int">
|
||||
SELECT count(1)
|
||||
FROM xxl_job_info t
|
||||
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
||||
<if test="jobGroup gt 0">
|
||||
AND t.job_group = #{jobGroup}
|
||||
</if>
|
||||
<if test="triggerStatus gte 0">
|
||||
AND t.trigger_status = #{triggerStatus}
|
||||
</if>
|
||||
<if test="jobDesc != null and jobDesc != ''">
|
||||
AND t.job_desc like CONCAT(CONCAT('%', #{jobDesc,jdbcType=VARCHAR}), '%')
|
||||
</if>
|
||||
<if test="executorHandler != null and executorHandler != ''">
|
||||
AND t.executor_handler like CONCAT(CONCAT('%', #{executorHandler,jdbcType=VARCHAR}), '%')
|
||||
</if>
|
||||
<if test="author != null and author != ''">
|
||||
AND t.author like CONCAT(CONCAT('%', #{author,jdbcType=VARCHAR}), '%')
|
||||
</if>
|
||||
</trim>
|
||||
</select>
|
||||
|
||||
<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobInfo" useGeneratedKeys="true" keyProperty="id" >
|
||||
<selectKey keyProperty="id" resultType="int" order="BEFORE">
|
||||
select <include refid="XXL_JOB_INFO_ID" /> from dual
|
||||
</selectKey>
|
||||
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,
|
||||
trigger_status,
|
||||
trigger_last_time,
|
||||
trigger_next_time
|
||||
) VALUES (
|
||||
#{id},
|
||||
#{jobGroup},
|
||||
#{jobCron,jdbcType=VARCHAR},
|
||||
#{jobDesc,jdbcType=VARCHAR},
|
||||
#{addTime},
|
||||
#{updateTime},
|
||||
#{author,jdbcType=VARCHAR},
|
||||
#{alarmEmail,jdbcType=VARCHAR},
|
||||
#{executorRouteStrategy,jdbcType=VARCHAR},
|
||||
#{executorHandler,jdbcType=VARCHAR},
|
||||
#{executorParam,jdbcType=VARCHAR},
|
||||
#{executorBlockStrategy,jdbcType=VARCHAR},
|
||||
#{executorTimeout,jdbcType=VARCHAR},
|
||||
#{executorFailRetryCount},
|
||||
#{glueType,jdbcType=VARCHAR},
|
||||
#{glueSource,jdbcType=CLOB},
|
||||
#{glueRemark,jdbcType=VARCHAR},
|
||||
#{glueUpdatetime},
|
||||
#{childJobId,jdbcType=VARCHAR},
|
||||
#{triggerStatus},
|
||||
#{triggerLastTime},
|
||||
#{triggerNextTime}
|
||||
)
|
||||
<!--<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
|
||||
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" />
|
||||
FROM xxl_job_info t
|
||||
WHERE t.id = #{id}
|
||||
</select>
|
||||
|
||||
<update id="update" parameterType="com.xxl.job.admin.core.model.XxlJobInfo" >
|
||||
UPDATE xxl_job_info
|
||||
SET
|
||||
job_group = #{jobGroup},
|
||||
job_cron = #{jobCron,jdbcType=VARCHAR},
|
||||
job_desc = #{jobDesc,jdbcType=VARCHAR},
|
||||
update_time = #{updateTime},
|
||||
author = #{author,jdbcType=VARCHAR},
|
||||
alarm_email = #{alarmEmail,jdbcType=VARCHAR},
|
||||
executor_route_strategy = #{executorRouteStrategy,jdbcType=VARCHAR},
|
||||
executor_handler = #{executorHandler,jdbcType=VARCHAR},
|
||||
executor_param = #{executorParam,jdbcType=VARCHAR},
|
||||
executor_block_strategy = #{executorBlockStrategy,jdbcType=VARCHAR},
|
||||
executor_timeout = ${executorTimeout},
|
||||
executor_fail_retry_count = ${executorFailRetryCount},
|
||||
glue_type = #{glueType,jdbcType=VARCHAR},
|
||||
glue_source = #{glueSource,jdbcType=CLOB},
|
||||
glue_remark = #{glueRemark,jdbcType=VARCHAR},
|
||||
glue_updatetime = #{glueUpdatetime},
|
||||
child_jobid = #{childJobId,jdbcType=VARCHAR},
|
||||
trigger_status = #{triggerStatus,jdbcType=INTEGER},
|
||||
trigger_last_time = #{triggerLastTime},
|
||||
trigger_next_time = #{triggerNextTime}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="delete" parameterType="java.util.HashMap">
|
||||
DELETE
|
||||
FROM xxl_job_info
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<select id="getJobsByGroup" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
|
||||
SELECT <include refid="Base_Column_List" />
|
||||
FROM xxl_job_info t
|
||||
WHERE t.job_group = #{jobGroup}
|
||||
</select>
|
||||
|
||||
<select id="findAllCount" resultType="int">
|
||||
SELECT count(1)
|
||||
FROM xxl_job_info
|
||||
</select>
|
||||
|
||||
|
||||
<select id="scheduleJobQuery" parameterType="java.util.HashMap" resultMap="XxlJobInfo">
|
||||
select * from (
|
||||
SELECT row_number() over(ORDER BY id ASC) r, <include refid="Base_Column_List"/>
|
||||
FROM xxl_job_info t
|
||||
WHERE t.trigger_status = 1
|
||||
and t.trigger_next_time <![CDATA[ <= ]]> #{maxNextTime}
|
||||
)
|
||||
where r between 0 and #{pagesize}
|
||||
</select>
|
||||
|
||||
<update id="scheduleUpdate" parameterType="com.xxl.job.admin.core.model.XxlJobInfo" >
|
||||
UPDATE xxl_job_info
|
||||
SET
|
||||
trigger_last_time = #{triggerLastTime},
|
||||
trigger_next_time = #{triggerNextTime},
|
||||
trigger_status = #{triggerStatus}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,79 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xxl.job.admin.dao.XxlJobLogGlueDao">
|
||||
|
||||
<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_source" property="glueSource" />
|
||||
<result column="glue_remark" property="glueRemark" />
|
||||
<result column="add_time" property="addTime" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
</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='XXL_JOB_LOGGLUE_ID'>XXL_JOB_LOGGLUE_ID.NEXTVAL</sql>
|
||||
|
||||
<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobLogGlue" useGeneratedKeys="true" keyProperty="id" >
|
||||
<selectKey keyProperty="id" resultType="int" order="BEFORE">
|
||||
select <include refid="XXL_JOB_LOGGLUE_ID" /> from dual
|
||||
</selectKey>
|
||||
INSERT INTO xxl_job_logglue (
|
||||
id,
|
||||
job_id,
|
||||
glue_type,
|
||||
glue_source,
|
||||
glue_remark,
|
||||
add_time,
|
||||
update_time
|
||||
) VALUES (
|
||||
#{id},
|
||||
#{jobId},
|
||||
#{glueType,jdbcType=VARCHAR},
|
||||
#{glueSource,jdbcType=CLOB},
|
||||
#{glueRemark,jdbcType=VARCHAR},
|
||||
#{addTime},
|
||||
#{updateTime}
|
||||
)
|
||||
<!--<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 t
|
||||
WHERE t.job_id = #{jobId}
|
||||
ORDER BY id DESC
|
||||
</select>
|
||||
|
||||
<delete id="removeOld" >
|
||||
DELETE FROM xxl_job_logglue
|
||||
WHERE id NOT in(
|
||||
SELECT id FROM(
|
||||
select * from (
|
||||
SELECT row_number() over(ORDER BY update_time desc) r,id FROM xxl_job_logglue
|
||||
WHERE job_id = #{jobId}
|
||||
)
|
||||
where r between 0 and #{limit}
|
||||
) t1
|
||||
) AND job_id = #{jobId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteByJobId" parameterType="java.lang.Integer" >
|
||||
DELETE FROM xxl_job_logglue
|
||||
WHERE job_id = #{jobId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,284 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xxl.job.admin.dao.XxlJobLogDao">
|
||||
|
||||
<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="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="trigger_time" property="triggerTime"/>
|
||||
<result column="trigger_code" property="triggerCode"/>
|
||||
<result column="trigger_msg" property="triggerMsg"/>
|
||||
|
||||
<result column="handle_time" property="handleTime"/>
|
||||
<result column="handle_code" property="handleCode"/>
|
||||
<result column="handle_msg" property="handleMsg"/>
|
||||
|
||||
<result column="alarm_status" property="alarmStatus"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
t.id,
|
||||
t.job_group,
|
||||
t.job_id,
|
||||
t.executor_address,
|
||||
t.executor_handler,
|
||||
t.executor_param,
|
||||
t.executor_sharding_param,
|
||||
t.executor_fail_retry_count,
|
||||
t.trigger_time,
|
||||
t.trigger_code,
|
||||
t.trigger_msg,
|
||||
t.handle_time,
|
||||
t.handle_code,
|
||||
t.handle_msg,
|
||||
t.alarm_status
|
||||
</sql>
|
||||
|
||||
<sql id='XXL_JOB_LOG_ID'>XXL_JOB_LOG_ID.NEXTVAL</sql>
|
||||
|
||||
<select id="pageList" resultMap="XxlJobLog">
|
||||
select * from (
|
||||
SELECT row_number() over(ORDER BY t.trigger_time DESC) r,
|
||||
<include refid="Base_Column_List"/>
|
||||
FROM xxl_job_log t
|
||||
<trim prefix="WHERE" prefixOverrides="AND | OR">
|
||||
<if test="jobId==0 and jobGroup gt 0">
|
||||
AND t.job_group = #{jobGroup}
|
||||
</if>
|
||||
<if test="jobId gt 0">
|
||||
AND t.job_id = #{jobId}
|
||||
</if>
|
||||
<if test="triggerTimeStart != null">
|
||||
AND t.trigger_time <![CDATA[ >= ]]> #{triggerTimeStart}
|
||||
</if>
|
||||
<if test="triggerTimeEnd != null">
|
||||
AND t.trigger_time <![CDATA[ <= ]]> #{triggerTimeEnd}
|
||||
</if>
|
||||
<if test="logStatus == 1">
|
||||
AND t.handle_code = 200
|
||||
</if>
|
||||
<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">
|
||||
AND t.trigger_code = 200
|
||||
AND t.handle_code = 0
|
||||
</if>
|
||||
</trim>
|
||||
)
|
||||
where r between #{offset}+1 and #{offset}+#{pagesize}
|
||||
</select>
|
||||
|
||||
<select id="pageListCount" resultType="int">
|
||||
SELECT count(1)
|
||||
FROM xxl_job_log t
|
||||
<trim prefix="WHERE" prefixOverrides="AND | OR">
|
||||
<if test="jobId==0 and jobGroup gt 0">
|
||||
AND t.job_group = #{jobGroup}
|
||||
</if>
|
||||
<if test="jobId gt 0">
|
||||
AND t.job_id = #{jobId}
|
||||
</if>
|
||||
<if test="triggerTimeStart != null">
|
||||
AND t.trigger_time <![CDATA[ >= ]]> #{triggerTimeStart}
|
||||
</if>
|
||||
<if test="triggerTimeEnd != null">
|
||||
AND t.trigger_time <![CDATA[ <= ]]> #{triggerTimeEnd}
|
||||
</if>
|
||||
<if test="logStatus == 1">
|
||||
AND t.handle_code = 200
|
||||
</if>
|
||||
<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">
|
||||
AND t.trigger_code = 200
|
||||
AND t.handle_code = 0
|
||||
</if>
|
||||
</trim>
|
||||
</select>
|
||||
|
||||
<select id="load" parameterType="java.lang.Long" resultMap="XxlJobLog">
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
FROM xxl_job_log t
|
||||
WHERE t.id = #{id}
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobLog" useGeneratedKeys="true" keyProperty="id">
|
||||
<selectKey keyProperty="id" resultType="int" order="BEFORE">
|
||||
select
|
||||
<include refid="XXL_JOB_LOG_ID"/>
|
||||
from dual
|
||||
</selectKey>
|
||||
INSERT INTO xxl_job_log (
|
||||
id,
|
||||
job_group,
|
||||
job_id,
|
||||
trigger_time,
|
||||
trigger_code,
|
||||
handle_code
|
||||
) VALUES (
|
||||
#{id},
|
||||
#{jobGroup},
|
||||
#{jobId},
|
||||
#{triggerTime},
|
||||
#{triggerCode},
|
||||
#{handleCode}
|
||||
)
|
||||
<!--<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
|
||||
SELECT LAST_INSERT_ID()
|
||||
</selectKey>-->
|
||||
</insert>
|
||||
|
||||
<update id="updateTriggerInfo">
|
||||
UPDATE xxl_job_log
|
||||
SET
|
||||
trigger_time= #{triggerTime},
|
||||
trigger_code= #{triggerCode},
|
||||
trigger_msg= #{triggerMsg,jdbcType=CLOB},
|
||||
executor_address= #{executorAddress,jdbcType=VARCHAR},
|
||||
executor_handler=#{executorHandler,jdbcType=VARCHAR},
|
||||
executor_param= #{executorParam,jdbcType=VARCHAR},
|
||||
executor_sharding_param= #{executorShardingParam,jdbcType=VARCHAR},
|
||||
executor_fail_retry_count= #{executorFailRetryCount}
|
||||
WHERE id= #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateHandleInfo">
|
||||
UPDATE xxl_job_log
|
||||
SET
|
||||
handle_time= #{handleTime},
|
||||
handle_code= #{handleCode},
|
||||
handle_msg= #{handleMsg,jdbcType=CLOB}
|
||||
WHERE id= #{id}
|
||||
</update>
|
||||
|
||||
<delete id="delete">
|
||||
delete from xxl_job_log
|
||||
WHERE job_id = #{jobId}
|
||||
</delete>
|
||||
|
||||
<!--<select id="triggerCountByDay" resultType="java.util.Map" >
|
||||
SELECT
|
||||
DATE_FORMAT(trigger_time,'%Y-%m-%d') triggerDay,
|
||||
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 handle_code = 200 then 1 else 0 end) as triggerDayCountSuc
|
||||
FROM xxl_job_log
|
||||
WHERE trigger_time BETWEEN #{from} and #{to}
|
||||
GROUP BY triggerDay
|
||||
ORDER BY triggerDay
|
||||
</select>-->
|
||||
|
||||
<select id="findLogReport" resultType="java.util.Map">
|
||||
SELECT
|
||||
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 handle_code = 200 then 1 else 0 end) as triggerDayCountSuc
|
||||
FROM xxl_job_log
|
||||
WHERE trigger_time BETWEEN #{from} and #{to}
|
||||
</select>
|
||||
|
||||
<select id="findClearLogIds" resultType="long">
|
||||
select * from (
|
||||
SELECT row_number() over(order by id asc) r,id FROM xxl_job_log
|
||||
<trim prefix="WHERE" prefixOverrides="AND | OR">
|
||||
<if test="jobGroup gt 0">
|
||||
AND job_group = #{jobGroup}
|
||||
</if>
|
||||
<if test="jobId gt 0">
|
||||
AND job_id = #{jobId}
|
||||
</if>
|
||||
<if test="clearBeforeTime != null">
|
||||
AND trigger_time <![CDATA[ <= ]]> #{clearBeforeTime}
|
||||
</if>
|
||||
<if test="clearBeforeNum gt 0">
|
||||
AND id NOT in(
|
||||
SELECT id FROM(
|
||||
select * from (
|
||||
SELECT row_number() over(ORDER BY t.trigger_time desc) r,id FROM xxl_job_log t
|
||||
<trim prefix="WHERE" prefixOverrides="AND | OR">
|
||||
<if test="jobGroup gt 0">
|
||||
AND t.job_group = #{jobGroup}
|
||||
</if>
|
||||
<if test="jobId gt 0">
|
||||
AND t.job_id = #{jobId}
|
||||
</if>
|
||||
</trim>
|
||||
) where r between 0 and #{clearBeforeNum}
|
||||
) t1
|
||||
)
|
||||
</if>
|
||||
</trim>
|
||||
)
|
||||
where r between 0 and #{pagesize}
|
||||
</select>
|
||||
|
||||
<delete id="clearLog">
|
||||
delete from xxl_job_log
|
||||
WHERE id in
|
||||
<foreach collection="logIds" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="findFailJobLogIds" resultType="long">
|
||||
SELECT id FROM xxl_job_log
|
||||
WHERE not (
|
||||
(trigger_code in (0, 200) and handle_code = 0)
|
||||
OR
|
||||
(handle_code = 200)
|
||||
)
|
||||
AND alarm_status = 0
|
||||
ORDER BY id
|
||||
</select>
|
||||
|
||||
|
||||
<select id="findFailJobLogId" resultType="long">
|
||||
SELECT id FROM xxl_job_log
|
||||
WHERE not (
|
||||
(trigger_code in (0, 200) and handle_code = 0)
|
||||
OR
|
||||
(handle_code = 200)
|
||||
)
|
||||
AND alarm_status = 0
|
||||
ORDER BY id
|
||||
</select>
|
||||
<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 t.id
|
||||
FROM xxl_job_log t
|
||||
WHERE t.trigger_code = 200
|
||||
and t.handle_code = 0
|
||||
and t.trigger_time <![CDATA[ <= ]]> #{losedTime}
|
||||
and t.executor_address not in (
|
||||
SELECT t2.registry_value
|
||||
FROM xxl_job_registry t2
|
||||
)
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xxl.job.admin.dao.XxlJobLogReportDao">
|
||||
|
||||
<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="suc_count" property="sucCount" />
|
||||
<result column="fail_count" property="failCount" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
t.id,
|
||||
t.trigger_day,
|
||||
t.running_count,
|
||||
t.suc_count,
|
||||
t.fail_count
|
||||
</sql>
|
||||
|
||||
<sql id='XXL_JOB_LOG_REPORT_ID'>XXL_JOB_LOG_REPORT_ID.NEXTVAL</sql>
|
||||
|
||||
<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobLogReport" useGeneratedKeys="true" keyProperty="id" >
|
||||
<selectKey keyProperty="id" resultType="int" order="BEFORE">
|
||||
select <include refid="XXL_JOB_LOG_REPORT_ID" /> from dual
|
||||
</selectKey>
|
||||
INSERT INTO xxl_job_log_report (
|
||||
id,
|
||||
trigger_day,
|
||||
running_count,
|
||||
suc_count,
|
||||
fail_count
|
||||
) VALUES (
|
||||
#{id},
|
||||
#{triggerDay},
|
||||
#{runningCount},
|
||||
#{sucCount},
|
||||
#{failCount}
|
||||
)
|
||||
<!--<selectKey resultType="java.lang.Integer" order="AFTER" keyProperty="id">
|
||||
SELECT LAST_INSERT_ID()
|
||||
</selectKey>-->
|
||||
</insert>
|
||||
|
||||
<update id="update" >
|
||||
UPDATE xxl_job_log_report
|
||||
SET running_count = #{runningCount},
|
||||
suc_count = #{sucCount},
|
||||
fail_count = #{failCount}
|
||||
WHERE trigger_day = #{triggerDay}
|
||||
</update>
|
||||
|
||||
<select id="queryLogReport" resultMap="XxlJobLogReport">
|
||||
SELECT <include refid="Base_Column_List" />
|
||||
FROM xxl_job_log_report t
|
||||
WHERE t.trigger_day between #{triggerDayFrom} and #{triggerDayTo}
|
||||
ORDER BY t.trigger_day ASC
|
||||
</select>
|
||||
|
||||
<select id="queryLogReportTotal" resultMap="XxlJobLogReport">
|
||||
SELECT
|
||||
SUM(running_count) running_count,
|
||||
SUM(suc_count) suc_count,
|
||||
SUM(fail_count) fail_count
|
||||
FROM xxl_job_log_report t
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xxl.job.admin.dao.XxlJobRegistryDao">
|
||||
|
||||
<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" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
t.id,
|
||||
t.registry_group,
|
||||
t.registry_key,
|
||||
t.registry_value,
|
||||
t.update_time
|
||||
</sql>
|
||||
|
||||
<sql id='XXL_JOB_REGISTRY_ID'>XXL_JOB_REGISTRY_ID.NEXTVAL</sql>
|
||||
|
||||
<select id="findDead" parameterType="java.util.HashMap" resultType="java.lang.Integer" >
|
||||
SELECT t.id
|
||||
FROM xxl_job_registry t
|
||||
WHERE t.update_time <![CDATA[ < ]]> #{nowTime} + numtodsinterval(-#{timeout},'second')
|
||||
</select>
|
||||
|
||||
<delete id="removeDead" parameterType="java.lang.Integer" >
|
||||
DELETE FROM xxl_job_registry
|
||||
WHERE id in
|
||||
<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" />
|
||||
FROM xxl_job_registry t
|
||||
WHERE t.update_time <![CDATA[ > ]]> #{nowTime} + numtodsinterval(-#{timeout},'second')
|
||||
</select>
|
||||
|
||||
<update id="registryUpdate" >
|
||||
UPDATE xxl_job_registry
|
||||
SET update_time = #{updateTime}
|
||||
WHERE registry_group = #{registryGroup,jdbcType=VARCHAR}
|
||||
AND registry_key = #{registryKey,jdbcType=VARCHAR}
|
||||
AND registry_value = #{registryValue,jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
||||
<insert id="registrySave" >
|
||||
<selectKey keyProperty="id" resultType="int" order="BEFORE">
|
||||
select <include refid="XXL_JOB_REGISTRY_ID" /> from dual
|
||||
</selectKey>
|
||||
INSERT INTO xxl_job_registry( id, registry_group , registry_key , registry_value, update_time)
|
||||
VALUES(#{id}, #{registryGroup,jdbcType=VARCHAR} , #{registryKey,jdbcType=VARCHAR} , #{registryValue,jdbcType=VARCHAR}, #{updateTime})
|
||||
</insert>
|
||||
|
||||
<delete id="registryDelete" >
|
||||
DELETE FROM xxl_job_registry
|
||||
WHERE registry_group = #{registryGroup,jdbcType=VARCHAR}
|
||||
AND registry_key = #{registryKey,jdbcType=VARCHAR}
|
||||
AND registry_value = #{registryValue,jdbcType=VARCHAR}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,95 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xxl.job.admin.dao.XxlJobUserDao">
|
||||
|
||||
<resultMap id="XxlJobUser" type="com.xxl.job.admin.core.model.XxlJobUser" >
|
||||
<result column="id" property="id" />
|
||||
<result column="username" property="username" />
|
||||
<result column="password" property="password" />
|
||||
<result column="role" property="role" />
|
||||
<result column="permission" property="permission" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
t.id,
|
||||
t.username,
|
||||
t.password,
|
||||
t.role,
|
||||
t.permission
|
||||
</sql>
|
||||
|
||||
<sql id='XXL_JOB_USER_ID'>XXL_JOB_USER_ID.NEXTVAL</sql>
|
||||
|
||||
<select id="pageList" parameterType="java.util.HashMap" resultMap="XxlJobUser">
|
||||
select * from (
|
||||
SELECT row_number() over(ORDER BY username ASC) r, <include refid="Base_Column_List"/>
|
||||
FROM xxl_job_user t
|
||||
<trim prefix="WHERE" prefixOverrides="AND | OR">
|
||||
<if test="username != null and username != ''">
|
||||
AND t.username like CONCAT(CONCAT('%', #{username,jdbcType=VARCHAR}), '%')
|
||||
</if>
|
||||
<if test="role gt -1">
|
||||
AND t.role = #{role}
|
||||
</if>
|
||||
</trim>
|
||||
)
|
||||
where r between #{offset}+1 and #{offset}+#{pagesize}
|
||||
</select>
|
||||
|
||||
<select id="pageListCount" parameterType="java.util.HashMap" resultType="int">
|
||||
SELECT count(1)
|
||||
FROM xxl_job_user t
|
||||
<trim prefix="WHERE" prefixOverrides="AND | OR" >
|
||||
<if test="username != null and username != ''">
|
||||
AND t.username like CONCAT(CONCAT('%', #{username,jdbcType=VARCHAR}), '%')
|
||||
</if>
|
||||
<if test="role gt -1">
|
||||
AND t.role = #{role}
|
||||
</if>
|
||||
</trim>
|
||||
</select>
|
||||
|
||||
<select id="loadByUserName" parameterType="java.util.HashMap" resultMap="XxlJobUser">
|
||||
SELECT <include refid="Base_Column_List" />
|
||||
FROM xxl_job_user t
|
||||
WHERE t.username = #{username,jdbcType=VARCHAR}
|
||||
</select>
|
||||
|
||||
<insert id="save" parameterType="com.xxl.job.admin.core.model.XxlJobUser" useGeneratedKeys="true" keyProperty="id" >
|
||||
<selectKey keyProperty="id" resultType="int" order="BEFORE">
|
||||
select <include refid="XXL_JOB_USER_ID" /> from dual
|
||||
</selectKey>
|
||||
INSERT INTO xxl_job_user (
|
||||
id,
|
||||
username,
|
||||
password,
|
||||
role,
|
||||
permission
|
||||
) VALUES (
|
||||
#{id},
|
||||
#{username,jdbcType=VARCHAR},
|
||||
#{password,jdbcType=VARCHAR},
|
||||
#{role},
|
||||
#{permission,jdbcType=VARCHAR}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<update id="update" parameterType="com.xxl.job.admin.core.model.XxlJobUser" >
|
||||
UPDATE xxl_job_user
|
||||
SET
|
||||
<if test="password != null and password != ''">
|
||||
password = #{password,jdbcType=VARCHAR},
|
||||
</if>
|
||||
role = #{role},
|
||||
permission = #{permission,jdbcType=VARCHAR}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="delete" parameterType="java.util.HashMap">
|
||||
DELETE
|
||||
FROM xxl_job_user
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
Loading…
Reference in new issue