quartz-task-config-mapper.xml 1.57 KB
<?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.cjs.cms.dao.pub.QuartzTaskConfigDao">
	
	<sql id="quartz_task_config_field">
		id, class_name, active_id, task_type, start_date, sched_type, cron, interval_ms, times, status, remark, create_at 
	</sql>

	<insert id="insert" parameterType="QuartzTaskConfigInfo" useGeneratedKeys="true" keyProperty="id">
		insert into quartz_task_config(class_name, active_id, task_type, start_date, sched_type, cron, interval_ms, times, status, remark, create_at) 
		values(#{className}, #{activeId}, #{taskType}, #{startDate}, #{schedType}, #{cron}, #{intervalMs}, #{times}, #{status}, #{remark}, CURRENT_TIMESTAMP)
	</insert>
	
	<select id="queryTasks" resultType="QuartzTaskConfigInfo">
		select <include refid="quartz_task_config_field" />
		from quartz_task_config 
		where status = '0'
	</select>

	<select id="queryTaskById" parameterType="int" resultType="QuartzTaskConfigInfo">
		select <include refid="quartz_task_config_field" />
		from quartz_task_config 
		where id = #{id}
	</select>
	
	<select id="queryTaskByCondition" parameterType="map" resultType="QuartzTaskConfigInfo">
		select <include refid="quartz_task_config_field" /> 
		from quartz_task_config 
		where task_type = #{taskType} and active_id = #{activeId} and status = '0' and remark = #{remark}
	</select>
	
	<update id="updateStartDate" parameterType="QuartzTaskConfigInfo">
		update quartz_task_config set start_date = #{startDate} 
		where id = #{id}
	</update>
</mapper>