ErrorLogMapper.xml
1.61 KB
<?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">
<select id="selectListEntity" parameterType="com.huaheng.pc.monitor.errorlog.domain.ErrorLog" resultType="com.huaheng.pc.monitor.errorlog.domain.ErrorLog">
select event_id, timestmp, formatted_message, logger_name, level_string, thread_name, reference_flag, arg0,arg1,arg2,arg3,caller_filename,caller_class,caller_method,caller_line,creatTime
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>