JobLogMapper.xml
4.19 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
<?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.JobLogMapper">
<resultMap type="com.huaheng.pc.monitor.job.domain.JobLog" id="JobLogResult">
<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="jobMessage" column="jobMessage"/>
<result property="status" column="status"/>
<result property="exceptionInfo" column="exceptionInfo"/>
<result property="createTime" column="createTime"/>
</resultMap>
<sql id="selectJobLogVo">
select id,
jobName,
jobGroup,
methodName,
methodParams,
jobMessage,
status,
exceptionInfo,
createTime
from sys_job_log
</sql>
<select id="selectJobLogList" parameterType="com.huaheng.pc.monitor.job.domain.JobLog" resultMap="JobLogResult">
<include refid="selectJobLogVo"/>
<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>
<if test="params != null and params.beginTime != null"><!-- 开始时间检索 -->
and date_format(createTime,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params != null and params.endTime != null"><!-- 结束时间检索 -->
and date_format(createTime,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
</if>
</where>
</select>
<select id="selectJobLogById" parameterType="Integer" resultMap="JobLogResult">
<include refid="selectJobLogVo"/>
where id = #{id}
</select>
<delete id="deleteJobLogById" parameterType="Integer">
delete
from sys_job_log
where id = #{id}
</delete>
<delete id="deleteJobLogByIds" parameterType="String">
delete from sys_job_log where id in
<foreach collection="array" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<insert id="insertJobLog" parameterType="com.huaheng.pc.monitor.job.domain.JobLog">
insert into sys_job_log(
<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="jobMessage != null and jobMessage != ''">jobMessage,</if>
<if test="status != null and status != ''">status,</if>
<if test="exceptionInfo != null and exceptionInfo != ''">exceptionInfo,</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="jobMessage != null and jobMessage != ''">#{jobMessage},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="exceptionInfo != null and exceptionInfo != ''">#{exceptionInfo},</if>
sysdate()
)
</insert>
<update id="truncateTable">
DELETE
FROM api_log
WHERE apiName IN ('wcs任务完成', 'wcs调用wms分配库位', 'wcs到达拣选台', 'wms下发任务到wcs')
</update>
</mapper>