108 lines
4.9 KiB
XML
Raw Normal View History

2018-07-09 08:44:52 +08:00
<?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.ruoyi.project.monitor.job.mapper.JobMapper">
<resultMap type="Job" id="JobResult">
<id property="jobId" column="job_id" />
<result property="jobName" column="job_name" />
<result property="jobGroup" column="job_group" />
<result property="methodName" column="method_name" />
2018-07-19 21:17:17 +08:00
<result property="methodParams" column="method_params" />
2018-07-09 08:44:52 +08:00
<result property="cronExpression" column="cron_expression" />
2018-07-20 17:21:43 +08:00
<result property="misfirePolicy" column="misfire_policy" />
2018-07-09 08:44:52 +08:00
<result property="status" column="status" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectJobVo">
2018-07-20 17:21:43 +08:00
select job_id, job_name, job_group, method_name, method_params, cron_expression, misfire_policy, status, create_by, create_time, remark from sys_job
2018-07-09 08:44:52 +08:00
</sql>
<select id="selectJobList" parameterType="Job" resultMap="JobResult">
<include refid="selectJobVo"/>
<where>
<if test="jobName != null and jobName != ''">
AND job_name like concat('%', #{jobName}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="methodName != null and methodName != ''">
AND method_name like concat('%', #{methodName}, '%')
</if>
</where>
</select>
<select id="selectJobAll" resultMap="JobResult">
<include refid="selectJobVo"/>
</select>
<select id="selectJobById" parameterType="Long" resultMap="JobResult">
<include refid="selectJobVo"/>
where job_id = #{jobId}
</select>
<delete id="deleteJobById" parameterType="Long">
delete from sys_job where job_id = #{jobId}
</delete>
<delete id="deleteJobByIds" parameterType="Long">
delete from sys_job where job_id in
<foreach collection="array" item="jobId" open="(" separator="," close=")">
#{jobId}
</foreach>
</delete>
<update id="updateJob" parameterType="Job">
update sys_job
<set>
<if test="jobName != null and jobName != ''">job_name = #{jobName},</if>
<if test="jobGroup != null and jobGroup != ''">job_group = #{jobGroup},</if>
<if test="methodName != null and methodName != ''">method_name = #{methodName},</if>
2018-07-19 21:17:17 +08:00
<if test="methodParams != null and methodParams != ''">method_params = #{methodParams},</if>
2018-07-09 08:44:52 +08:00
<if test="cronExpression != null and cronExpression != ''">cron_expression = #{cronExpression},</if>
2018-07-20 17:21:43 +08:00
<if test="misfirePolicy != null and misfirePolicy != ''">misfire_policy = #{misfirePolicy},</if>
2018-07-09 08:44:52 +08:00
<if test="status !=null">status = #{status},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
update_time = sysdate()
</set>
where 1=1
<if test="jobId != null">and job_id = #{jobId}</if>
</update>
<insert id="insertJob" parameterType="Post" useGeneratedKeys="true" keyProperty="jobId">
insert into sys_job(
<if test="jobId != null and jobId != 0">job_id,</if>
<if test="jobName != null and jobName != ''">job_name,</if>
<if test="jobGroup != null and jobGroup != ''">job_group,</if>
<if test="methodName != null and methodName != ''">method_name,</if>
2018-07-19 21:17:17 +08:00
<if test="methodParams != null and methodParams != ''">method_params,</if>
2018-07-09 08:44:52 +08:00
<if test="cronExpression != null and cronExpression != ''">cron_expression,</if>
2018-07-20 17:21:43 +08:00
<if test="misfirePolicy != null and misfirePolicy != ''">misfire_policy,</if>
2018-07-09 08:44:52 +08:00
<if test="status != null and status != ''">status,</if>
<if test="remark != null and remark != ''">remark,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
create_time
)values(
<if test="jobId != null and jobId != 0">#{jobId},</if>
<if test="jobName != null and jobName != ''">#{jobName},</if>
<if test="jobGroup != null and jobGroup != ''">#{jobGroup},</if>
<if test="methodName != null and methodName != ''">#{methodName},</if>
2018-07-19 21:17:17 +08:00
<if test="methodParams != null and methodParams != ''">#{method_params},</if>
2018-07-09 08:44:52 +08:00
<if test="cronExpression != null and cronExpression != ''">#{cronExpression},</if>
2018-07-20 17:21:43 +08:00
<if test="misfirePolicy != null and misfirePolicy != ''">#{misfirePolicy},</if>
2018-07-09 08:44:52 +08:00
<if test="status != null and status != ''">#{status},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
sysdate()
)
</insert>
</mapper>