<?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="net.chenlin.dp.modules.quartz.dao.QuartzJobLogMapper">
	
	<select id="listForPage" resultType="net.chenlin.dp.modules.quartz.entity.QuartzJobLogEntity">
		SELECT
			log_id,
			job_id,
			bean_name,
			method_name,
			params,
			status,
			error,
			times,
			gmt_create
		FROM
			quartz_job_log
		<where>
			<if test="name != null and name.trim() != ''">
				AND bean_name LIKE concat('%',#{name},'%')
			</if>
		</where>
		ORDER BY
			gmt_create DESC
	</select>
	
	<insert id="save">
		INSERT INTO quartz_job_log (
			job_id,
			bean_name,
			method_name,
			params,
			status,
			error,
			times,
			gmt_create
		)
		VALUES (
			#{jobId},
			#{beanName}, 
			#{methodName},
			#{params}, 
			#{status}, 
			#{error}, 
			#{times}, 
			NOW()
		)
	</insert>
	
	<delete id="batchRemove">
		DELETE
		FROM
			quartz_job_log
		WHERE
			log_id IN
		<foreach item="id" collection="array" open="(" separator="," close=")">
			#{id}
		</foreach>
	</delete>
	
	<delete id="batchRemoveAll">
		DELETE
		FROM
			quartz_job_log
	</delete>

</mapper>