JobMapper.xml
4.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?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.huaheng.pc.monitor.job.mapper.JobMapper">
<resultMap type="com.huaheng.pc.monitor.job.domain.Job" id="JobResult">
<id property="id" column="id" />
<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" />
<result property="status" column="status" />
<result property="createBy" column="createBy" />
<result property="createTime" column="createTime" />
<result property="updateBy" column="updateBy" />
<result property="updateTime" column="updateTime" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectJobVo">
select id, jobName, jobGroup, methodName, methodParams, cronExpression, misfirePolicy, status, createBy, createTime, remark from sys_job
</sql>
<select id="selectJobList" resultMap="JobResult">
<include refid="selectJobVo"/>
<where>
<if test="jobName != null and jobName != ''">
AND jobName like concat('%', #{jobName}, '%')
</if>
<if test="status != null and status != ''">
AND status = #{status}
</if>
<if test="methodName != null and methodName != ''">
AND methodName like concat('%', #{methodName}, '%')
</if>
</where>
</select>
<select id="selectJobAll" resultMap="JobResult">
<include refid="selectJobVo"/>
</select>
<select id="selectJobById" resultMap="JobResult">
<include refid="selectJobVo"/>
where id = #{id}
</select>
<delete id="deleteJobById">
delete from sys_job where id = #{id}
</delete>
<delete id="deleteJobByIds">
delete from sys_job where id in
<foreach collection="array" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<update id="updateJob">
update sys_job
<set>
<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>
<if test="status !=null">status = #{status},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<if test="updateBy != null and updateBy != ''">updateBy = #{updateBy},</if>
updateTime = sysdate()
</set>
where id = #{id}
</update>
<insert id="insertJob" useGeneratedKeys="true" keyProperty="id">
insert into sys_job(
<if test="id != null and id != 0">id,</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>
<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>
createTime
)values(
<if test="id != null and id != 0">#{id},</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>
<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>