Blame view

src/main/resources/mybatis/monitor/JobMapper.xml 4.49 KB
1
2
3
4
<?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">
5
<mapper namespace="com.huaheng.pc.monitor.job.mapper.JobMapper">
6
7

	<resultMap type="Job" id="JobResult">
8
		<id     property="id"          column="id"          />
9
10
11
12
13
14
		<result property="jobName"        column="jobName"        />
		<result property="jobGroup"       column="jobGroup"       />
		<result property="methodName"     column="methodName"     />
		<result property="methodParams"   column="methodParams"   />
		<result property="cronExpression" column="cronExpression" />
		<result property="misfirePolicy"  column="misfirePolicy"  />
15
		<result property="status"         column="status"          />
16
17
18
19
		<result property="createBy"       column="createBy"       />
		<result property="createTime"     column="createTime"     />
		<result property="updateBy"       column="updateBy"       />
		<result property="updateTime"     column="updateTime"     />
20
21
22
23
		<result property="remark"         column="remark"          />
	</resultMap>

	<sql id="selectJobVo">
24
        select id, jobName, jobGroup, methodName, methodParams, cronExpression, misfirePolicy, status, createBy, createTime, remark from sys_job
25
26
    </sql>
27
	<select id="selectJobList" resultMap="JobResult">
28
29
30
		<include refid="selectJobVo"/>
		<where>
			<if test="jobName != null and jobName != ''">
31
				AND jobName like concat('%', #{jobName}, '%')
32
33
34
35
36
			</if>
			<if test="status != null and status != ''">
				AND status = #{status}
			</if>
			<if test="methodName != null and methodName != ''">
37
				AND methodName like concat('%', #{methodName}, '%')
38
39
40
41
42
43
44
45
			</if>
		</where>
	</select>

	<select id="selectJobAll" resultMap="JobResult">
		<include refid="selectJobVo"/>
	</select>
46
	<select id="selectJobById" resultMap="JobResult">
47
		<include refid="selectJobVo"/>
48
		where id = #{id}
49
50
	</select>
51
	<delete id="deleteJobById">
52
 		delete from sys_job where id = #{id}
53
54
 	</delete>
55
 	<delete id="deleteJobByIds">
56
57
58
 		delete from sys_job where id in
 		<foreach collection="array" item="id" open="(" separator="," close=")">
 			#{id}
59
60
61
        </foreach> 
 	</delete>
62
 	<update id="updateJob">
63
64
 		update sys_job
 		<set>
65
66
67
68
69
70
 			<if test="jobName != null and jobName != ''">jobName = #{jobName},</if>
 			<if test="jobGroup != null and jobGroup != ''">jobGroup = #{jobGroup},</if>
 			<if test="methodName != null and methodName != ''">methodName = #{methodName},</if>
 			<if test="methodParams != null and methodParams != ''">methodParams = #{methodParams},</if>
 			<if test="cronExpression != null and cronExpression != ''">cronExpression = #{cronExpression},</if>
 			<if test="misfirePolicy != null and misfirePolicy != ''">misfirePolicy = #{misfirePolicy},</if>
71
72
 			<if test="status !=null">status = #{status},</if>
 			<if test="remark != null and remark != ''">remark = #{remark},</if>
73
74
 			<if test="updateBy != null and updateBy != ''">updateBy = #{updateBy},</if>
 			updateTime = sysdate()
75
 		</set>
76
 		where id = #{id}
77
78
	</update>
79
 	<insert id="insertJob" useGeneratedKeys="true" keyProperty="id">
80
 		insert into sys_job(
81
 			<if test="id != null and id != 0">id,</if>
82
83
84
85
86
87
 			<if test="jobName != null and jobName != ''">jobName,</if>
 			<if test="jobGroup != null and jobGroup != ''">jobGroup,</if>
 			<if test="methodName != null and methodName != ''">methodName,</if>
 			<if test="methodParams != null and methodParams != ''">methodParams,</if>
 			<if test="cronExpression != null and cronExpression != ''">cronExpression,</if>
 			<if test="misfirePolicy != null and misfirePolicy != ''">misfirePolicy,</if>
88
89
 			<if test="status != null and status != ''">status,</if>
 			<if test="remark != null and remark != ''">remark,</if>
90
91
 			<if test="createBy != null and createBy != ''">createBy,</if>
 			createTime
92
 		)values(
93
 			<if test="id != null and id != 0">#{id},</if>
94
95
96
97
98
99
100
101
102
103
104
105
106
107
 			<if test="jobName != null and jobName != ''">#{jobName},</if>
 			<if test="jobGroup != null and jobGroup != ''">#{jobGroup},</if>
 			<if test="methodName != null and methodName != ''">#{methodName},</if>
 			<if test="methodParams != null and methodParams != ''">#{methodParams},</if>
 			<if test="cronExpression != null and cronExpression != ''">#{cronExpression},</if>
 			<if test="misfirePolicy != null and misfirePolicy != ''">#{misfirePolicy},</if>
 			<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>