ErrorLogMapper.xml
2.59 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
<?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.errorlog.mapper.ErrorLogMapper">
<resultMap type="com.huaheng.pc.monitor.errorlog.domain.ErrorLog" id="ErrorLogResult">
<id property="event_id" column="event_id" />
<result property="timestmp" column="timestmp" />
<result property="formatted_message" column="formatted_message" />
<result property="logger_name" column="logger_name" />
<result property="level_string" column="level_string" />
<result property="thread_name" column="thread_name" />
<result property="reference_flag" column="reference_flag" />
<result property="arg0" column="arg0" />
<result property="arg1" column="arg1" />
<result property="arg3" column="arg3" />
<result property="caller_filename" column="caller_filename" />
<result property="caller_class" column="caller_class" />
<result property="caller_method" column="caller_method" />
<result property="caller_line" column="caller_line" />
<result property="creatTime" column="creatTime" />
</resultMap>
<select id="selectListEntity" parameterType="com.huaheng.pc.monitor.errorlog.domain.ErrorLog" resultType="com.huaheng.pc.monitor.errorlog.domain.ErrorLog">
select * from logging_event
<where>
AND level_string = 'ERROR'
<if test="caller_method != null and caller_method != ''">
AND caller_method = #{caller_method}
</if>
<if test="params != null and params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
and date_format(creatTime,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params != null and params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
and date_format(creatTime,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
</if>
</where>
</select>
<select id="selectErrorLogById" resultType="com.huaheng.pc.monitor.errorlog.domain.ErrorLog">
select timestmp, formatted_message, logger_name, level_string, thread_name, reference_flag, arg0,arg1,arg2,arg3,caller_filename,caller_class,caller_method,caller_line
from logging_event
where event_id = #{event_id}
</select>
<delete id="truncateTable">
delete from logging_event where creatTime < DATE_ADD(now(),INTERVAL '-15' day)
</delete>
</mapper>