日志导出忽略分页

This commit is contained in:
XinWei 2024-07-12 14:11:57 +08:00
parent 09e269947d
commit f691164000

View File

@ -45,7 +45,8 @@
</sql> </sql>
<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">
@ -90,7 +91,8 @@
<result column="status" property="status"/> <result column="status" property="status"/>
</resultMap> </resultMap>
<select id="apiPageList" resultMap="ApiXxlJobLog"> <select id="apiPageList" resultMap="ApiXxlJobLog">
SELECT <include refid="Base_Column_List" />, ROW_NUMBER() OVER (ORDER BY t.trigger_time) AS 'index', (t.handle_time -t.trigger_time) AS 'duration', SELECT<include refid="Base_Column_List"/>, ROW_NUMBER() OVER (ORDER BY t.trigger_time) AS 'index',
(t.handle_time -t.trigger_time) AS 'duration',
IF(t.handle_code = 200, 1, 2) AS 'status' IF(t.handle_code = 200, 1, 2) AS 'status'
FROM xxl_job_log AS t FROM xxl_job_log AS t
<trim prefix="WHERE" prefixOverrides="AND | OR"> <trim prefix="WHERE" prefixOverrides="AND | OR">
@ -124,7 +126,9 @@
</if> </if>
</trim> </trim>
ORDER BY t.trigger_time DESC ORDER BY t.trigger_time DESC
<if test="pagesize > 0">
LIMIT #{offset}, #{pagesize} LIMIT #{offset}, #{pagesize}
</if>
</select> </select>
<select id="pageListCount" resultType="int"> <select id="pageListCount" resultType="int">
@ -194,7 +198,8 @@
</select> </select>
<select id="load" parameterType="java.lang.Long" resultMap="XxlJobLog"> <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 FROM xxl_job_log AS t
WHERE t.id = #{id} WHERE t.id = #{id}
</select> </select>
@ -221,8 +226,7 @@
<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},
`trigger_msg`= #{triggerMsg}, `trigger_msg`= #{triggerMsg},
`executor_address`= #{executorAddress}, `executor_address`= #{executorAddress},
@ -235,15 +239,15 @@
<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},
`handle_msg`= #{handleMsg} `handle_msg`= #{handleMsg}
WHERE `id` = #{id} WHERE `id` = #{id}
</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>
@ -260,8 +264,7 @@
</select>--> </select>-->
<select id="findLogReport" resultType="java.util.Map"> <select id="findLogReport" resultType="java.util.Map">
SELECT SELECT 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
@ -311,9 +314,12 @@
</delete> </delete>
<select id="findFailJobLogIds" resultType="long"> <select id="findFailJobLogIds" resultType="long">
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
(handle_code = 200) (handle_code = 200)
) )
@ -324,19 +330,16 @@
<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}
WHERE `id`= #{logId} AND `alarm_status` = #{oldAlarmStatus} AND `alarm_status` = #{oldAlarmStatus}
</update> </update>
<select id="findLostJobIds" resultType="long"> <select id="findLostJobIds" resultType="long">
SELECT SELECT t.id
t.id FROM xxl_job_log t
FROM
xxl_job_log t
LEFT JOIN xxl_job_registry t2 ON t.executor_address = t2.registry_value LEFT JOIN xxl_job_registry t2 ON t.executor_address = t2.registry_value
WHERE WHERE t.trigger_code = 200
t.trigger_code = 200
AND t.handle_code = 0 AND t.handle_code = 0
AND t.trigger_time <![CDATA[ <= ]]> #{losedTime} AND t.trigger_time <![CDATA[ <= ]]> #{losedTime}
AND t2.id IS NULL; AND t2.id IS NULL;