first commit
This commit is contained in:
69
fys-logging/src/main/resources/mapper/SysLogMapper.xml
Normal file
69
fys-logging/src/main/resources/mapper/SysLogMapper.xml
Normal file
@ -0,0 +1,69 @@
|
||||
<?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.fuyuanshen.mapper.SysLogMapper">
|
||||
|
||||
<sql id="info_column">
|
||||
log_id id,description,method,params,request_ip,time,username,address,browser,exception_detail,create_time
|
||||
</sql>
|
||||
|
||||
<sql id="error_column">
|
||||
log_id id,description,method,params,request_ip,username,address,browser,exception_detail,create_time
|
||||
</sql>
|
||||
|
||||
<sql id="user_column">
|
||||
log_id id,description,request_ip,time,address,browser,create_time
|
||||
</sql>
|
||||
|
||||
<sql id="query">
|
||||
from sys_log
|
||||
<where>
|
||||
<if test="criteria.blurry != null and criteria.blurry != ''">
|
||||
and (
|
||||
username like concat('%',#{criteria.blurry},'%')
|
||||
or description like concat('%',#{criteria.blurry},'%')
|
||||
or address like concat('%',#{criteria.blurry},'%')
|
||||
or request_ip like concat('%',#{criteria.blurry},'%')
|
||||
or method like concat('%',#{criteria.blurry},'%')
|
||||
or params like concat('%',#{criteria.blurry},'%')
|
||||
)
|
||||
</if>
|
||||
<if test="criteria.username != null and criteria.username != ''">
|
||||
and username like concat('%',#{criteria.username},'%')
|
||||
</if>
|
||||
<if test="criteria.logType != null and criteria.logType != ''">
|
||||
and log_type = #{criteria.logType}
|
||||
</if>
|
||||
<if test="criteria.createTime != null and criteria.createTime.size() > 0">
|
||||
and create_time between #{criteria.createTime[0]} and #{criteria.createTime[1]}
|
||||
</if>
|
||||
</where>
|
||||
order by log_id desc
|
||||
</sql>
|
||||
|
||||
<select id="queryAll" resultType="com.fuyuanshen.domain.SysLog">
|
||||
select
|
||||
<choose>
|
||||
<when test="criteria.logType == 'ERROR'">
|
||||
<include refid="error_column"/>
|
||||
</when>
|
||||
<otherwise>
|
||||
<include refid="info_column"/>
|
||||
</otherwise>
|
||||
</choose>
|
||||
<include refid="query"/>
|
||||
</select>
|
||||
|
||||
<select id="queryAllByUser" resultType="com.fuyuanshen.domain.SysLog">
|
||||
select
|
||||
<include refid="user_column"/>
|
||||
<include refid="query"/>
|
||||
</select>
|
||||
|
||||
<delete id="deleteByLevel">
|
||||
delete from sys_log where log_type = #{logType}
|
||||
</delete>
|
||||
|
||||
<select id="getExceptionDetails" resultType="java.lang.String">
|
||||
select exception_detail from sys_log where log_id = #{id}
|
||||
</select>
|
||||
</mapper>
|
Reference in New Issue
Block a user