Blame view

src/main/resources/mybatis/monitor/JobLogMapper.xml 3.57 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.JobLogMapper">
6
7

	<resultMap type="JobLog" id="JobLogResult">
8
		<id     property="id"       column="id"      />
9
10
11
12
13
		<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"     />
14
		<result property="status"         column="status"          />
15
16
		<result property="exceptionInfo"  column="exceptionInfo"  />
		<result property="createTime"     column="createTime"     />
17
18
19
	</resultMap>

	<sql id="selectJobLogVo">
20
        select id, jobName, jobGroup, methodName, methodParams, jobMessage, status, exceptionInfo, createTime  from sys_job_log
21
22
23
24
25
26
    </sql>

	<select id="selectJobLogList" parameterType="JobLog" resultMap="JobLogResult">
		<include refid="selectJobLogVo"/>
		<where>
			<if test="jobName != null and jobName != ''">
27
				AND jobName like concat('%', #{jobName}, '%')
28
29
30
31
32
			</if>
			<if test="status != null and status != ''">
				AND status = #{status}
			</if>
			<if test="methodName != null and methodName != ''">
33
				AND methodName like concat('%', #{methodName}, '%')
34
			</if>
35
			<if test="params != null and params.beginTime != null"><!-- 开始时间检索 -->
36
				and date_format(createTime,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
37
			</if>
38
			<if test="params != null and params.endTime != null"><!-- 结束时间检索 -->
39
				and date_format(createTime,'%y%m%d') &lt;= date_format(#{params.endTime},'%y%m%d')
40
41
42
43
44
45
46
47
			</if>
		</where>
	</select>

	<select id="selectJobAll" resultMap="JobLogResult">
		<include refid="selectJobLogVo"/>
	</select>
48
	<select id="selectJobLogById" parameterType="Integer" resultMap="JobLogResult">
49
		<include refid="selectJobLogVo"/>
50
		where id = #{id}
51
52
	</select>
53
	<delete id="deleteJobLogById" parameterType="Integer">
54
 		delete from sys_job_log where id = #{id}
55
56
57
 	</delete>

 	<delete id="deleteJobLogByIds" parameterType="String">
58
59
60
 		delete from sys_job_log where id in
 		<foreach collection="array" item="id" open="(" separator="," close=")">
 			#{id}
61
62
63
64
65
        </foreach> 
 	</delete>

 	<insert id="insertJobLog" parameterType="JobLog">
 		insert into sys_job_log(
66
 			<if test="id != null and id != 0">id,</if>
67
68
69
70
71
 			<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>
72
 			<if test="status != null and status != ''">status,</if>
73
74
 			<if test="exceptionInfo != null and exceptionInfo != ''">exceptionInfo,</if>
 			createTime
75
 		)values(
76
 			<if test="id != null and id != 0">#{id},</if>
77
78
79
80
81
82
83
84
85
86
87
88
 			<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>

</mapper>