225 lines
9.5 KiB
XML
225 lines
9.5 KiB
XML
<?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.kexue.skills.mapper.SysLogMapper">
|
|
|
|
<resultMap type="com.kexue.skills.entity.SysLog" id="SysLogMap">
|
|
<result property="logId" column="LOG_ID" jdbcType="BIGINT"/>
|
|
<result property="traceId" column="TRACE_ID" jdbcType="VARCHAR"/>
|
|
<result property="description" column="DESCRIPTION" jdbcType="VARCHAR"/>
|
|
<result property="module" column="MODULE" jdbcType="VARCHAR"/>
|
|
<result property="requestUrl" column="REQUEST_URL" jdbcType="VARCHAR"/>
|
|
<result property="requestMethod" column="REQUEST_METHOD" jdbcType="VARCHAR"/>
|
|
<result property="requestHeaders" column="REQUEST_HEADERS" jdbcType="VARCHAR"/>
|
|
<result property="requestBody" column="REQUEST_BODY" jdbcType="VARCHAR"/>
|
|
<result property="statusCode" column="STATUS_CODE" jdbcType="INTEGER"/>
|
|
<result property="responseHeaders" column="RESPONSE_HEADERS" jdbcType="VARCHAR"/>
|
|
<result property="responseBody" column="RESPONSE_BODY" jdbcType="VARCHAR"/>
|
|
<result property="timeTaken" column="TIME_TAKEN" jdbcType="BIGINT"/>
|
|
<result property="ip" column="IP" jdbcType="VARCHAR"/>
|
|
<result property="address" column="ADDRESS" jdbcType="VARCHAR"/>
|
|
<result property="browser" column="BROWSER" jdbcType="VARCHAR"/>
|
|
<result property="os" column="OS" jdbcType="VARCHAR"/>
|
|
<result property="status" column="STATUS" jdbcType="TINYINT"/>
|
|
<result property="errorMsg" column="ERROR_MSG" jdbcType="VARCHAR"/>
|
|
<result property="createUser" column="CREATE_USER" jdbcType="BIGINT"/>
|
|
<result property="createTime" column="CREATE_TIME" jdbcType="TIMESTAMP"/>
|
|
<result property="updateTime" column="UPDATE_TIME" jdbcType="TIMESTAMP"/>
|
|
<result property="deleteFlag" column="DELETE_FLAG" jdbcType="TINYINT"/>
|
|
<result property="createBy" column="CREATE_BY" jdbcType="VARCHAR"/>
|
|
<result property="updateBy" column="UPDATE_BY" jdbcType="VARCHAR"/>
|
|
</resultMap>
|
|
|
|
<!--查询单个-->
|
|
<select id="queryById" resultMap="SysLogMap">
|
|
select
|
|
LOG_ID, TRACE_ID, DESCRIPTION, MODULE, REQUEST_URL, REQUEST_METHOD,
|
|
REQUEST_HEADERS, REQUEST_BODY, STATUS_CODE, RESPONSE_HEADERS, RESPONSE_BODY,
|
|
TIME_TAKEN, IP, ADDRESS, BROWSER, OS, STATUS, ERROR_MSG, CREATE_USER,
|
|
CREATE_TIME, UPDATE_TIME, DELETE_FLAG, CREATE_BY, UPDATE_BY
|
|
from sys_log
|
|
where LOG_ID = #{logId}
|
|
</select>
|
|
|
|
<!--查询指定行数据-->
|
|
<select id="getPageList" resultMap="SysLogMap">
|
|
select
|
|
LOG_ID, TRACE_ID, DESCRIPTION, MODULE, REQUEST_URL, REQUEST_METHOD,
|
|
REQUEST_HEADERS, REQUEST_BODY, STATUS_CODE, RESPONSE_HEADERS, RESPONSE_BODY,
|
|
TIME_TAKEN, IP, ADDRESS, BROWSER, OS, STATUS, ERROR_MSG, CREATE_USER,
|
|
CREATE_TIME, UPDATE_TIME, DELETE_FLAG, CREATE_BY, UPDATE_BY
|
|
from sys_log
|
|
<where>
|
|
<if test="logId != null">
|
|
and LOG_ID = #{logId}
|
|
</if>
|
|
<if test="module != null and module != ''">
|
|
and MODULE = #{module}
|
|
</if>
|
|
<if test="description != null and description != ''">
|
|
and DESCRIPTION like concat('%', #{description}, '%')
|
|
</if>
|
|
<if test="ip != null and ip != ''">
|
|
and IP = #{ip}
|
|
</if>
|
|
<if test="status != null">
|
|
and STATUS = #{status}
|
|
</if>
|
|
<if test="startTime != null">
|
|
and CREATE_TIME >= #{startTime}
|
|
</if>
|
|
<if test="endTime != null">
|
|
and CREATE_TIME <= #{endTime}
|
|
</if>
|
|
</where>
|
|
order by CREATE_TIME desc
|
|
</select>
|
|
|
|
<!--查询指定行数据-->
|
|
<select id="queryAllByLimit" resultMap="SysLogMap">
|
|
select
|
|
LOG_ID, TRACE_ID, DESCRIPTION, MODULE, REQUEST_URL, REQUEST_METHOD,
|
|
REQUEST_HEADERS, REQUEST_BODY, STATUS_CODE, RESPONSE_HEADERS, RESPONSE_BODY,
|
|
TIME_TAKEN, IP, ADDRESS, BROWSER, OS, STATUS, ERROR_MSG, CREATE_USER,
|
|
CREATE_TIME, UPDATE_TIME, DELETE_FLAG, CREATE_BY, UPDATE_BY
|
|
from sys_log
|
|
limit #{offset}, #{limit}
|
|
</select>
|
|
|
|
<!--通过实体作为筛选条件查询-->
|
|
<select id="queryAll" resultMap="SysLogMap">
|
|
select
|
|
LOG_ID, TRACE_ID, DESCRIPTION, MODULE, REQUEST_URL, REQUEST_METHOD,
|
|
REQUEST_HEADERS, REQUEST_BODY, STATUS_CODE, RESPONSE_HEADERS, RESPONSE_BODY,
|
|
TIME_TAKEN, IP, ADDRESS, BROWSER, OS, STATUS, ERROR_MSG, CREATE_USER,
|
|
CREATE_TIME, UPDATE_TIME, DELETE_FLAG, CREATE_BY, UPDATE_BY
|
|
from sys_log
|
|
<where>
|
|
<if test="logId != null">
|
|
and LOG_ID = #{logId}
|
|
</if>
|
|
<if test="module != null and module != ''">
|
|
and MODULE = #{module}
|
|
</if>
|
|
<if test="description != null and description != ''">
|
|
and DESCRIPTION like concat('%', #{description}, '%')
|
|
</if>
|
|
<if test="ip != null and ip != ''">
|
|
and IP = #{ip}
|
|
</if>
|
|
<if test="status != null">
|
|
and STATUS = #{status}
|
|
</if>
|
|
</where>
|
|
order by CREATE_TIME desc
|
|
</select>
|
|
|
|
<!--新增所有列-->
|
|
<insert id="insert" keyProperty="logId" useGeneratedKeys="true">
|
|
insert into sys_log(
|
|
TRACE_ID, DESCRIPTION, MODULE, REQUEST_URL, REQUEST_METHOD,
|
|
REQUEST_HEADERS, REQUEST_BODY, STATUS_CODE, RESPONSE_HEADERS, RESPONSE_BODY,
|
|
TIME_TAKEN, IP, ADDRESS, BROWSER, OS, STATUS, ERROR_MSG, CREATE_USER,
|
|
CREATE_TIME, UPDATE_TIME, DELETE_FLAG, CREATE_BY, UPDATE_BY
|
|
)
|
|
values (
|
|
#{traceId}, #{description}, #{module}, #{requestUrl}, #{requestMethod},
|
|
#{requestHeaders}, #{requestBody}, #{statusCode}, #{responseHeaders}, #{responseBody},
|
|
#{timeTaken}, #{ip}, #{address}, #{browser}, #{os}, #{status}, #{errorMsg}, #{createUser},
|
|
#{createTime}, #{updateTime}, #{deleteFlag}, #{createBy}, #{updateBy}
|
|
)
|
|
</insert>
|
|
|
|
|
|
<insert id="insertBatch" parameterType="java.util.List">
|
|
INSERT INTO sys_log (
|
|
<!-- 动态生成列名 -->
|
|
<foreach collection="list" item="item" index="index" open="" close="" separator="" >
|
|
<if test="index == 0">
|
|
<foreach collection="tableInfo.fullColumn" item="column" open="" close="" separator=",">
|
|
${column.name}
|
|
</foreach>
|
|
</if>
|
|
</foreach>
|
|
) VALUES
|
|
<!-- 动态生成值 -->
|
|
<foreach collection="list" item="item" index="index" open="" close="" separator=",">
|
|
(
|
|
<foreach collection="tableInfo.fullColumn" item="column" open="" close="" separator=",">
|
|
#{item.${column.property}}
|
|
</foreach>
|
|
)
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!--通过主键修改数据-->
|
|
<update id="update">
|
|
update sys_log
|
|
<set>
|
|
<if test="traceId != null and traceId != ''">
|
|
TRACE_ID = #{traceId},
|
|
</if>
|
|
<if test="description != null and description != ''">
|
|
DESCRIPTION = #{description},
|
|
</if>
|
|
<if test="module != null and module != ''">
|
|
MODULE = #{module},
|
|
</if>
|
|
<if test="requestUrl != null and requestUrl != ''">
|
|
REQUEST_URL = #{requestUrl},
|
|
</if>
|
|
<if test="requestMethod != null and requestMethod != ''">
|
|
REQUEST_METHOD = #{requestMethod},
|
|
</if>
|
|
<if test="requestHeaders != null and requestHeaders != ''">
|
|
REQUEST_HEADERS = #{requestHeaders},
|
|
</if>
|
|
<if test="requestBody != null and requestBody != ''">
|
|
REQUEST_BODY = #{requestBody},
|
|
</if>
|
|
<if test="statusCode != null">
|
|
STATUS_CODE = #{statusCode},
|
|
</if>
|
|
<if test="responseHeaders != null and responseHeaders != ''">
|
|
RESPONSE_HEADERS = #{responseHeaders},
|
|
</if>
|
|
<if test="responseBody != null and responseBody != ''">
|
|
RESPONSE_BODY = #{responseBody},
|
|
</if>
|
|
<if test="timeTaken != null">
|
|
TIME_TAKEN = #{timeTaken},
|
|
</if>
|
|
<if test="ip != null and ip != ''">
|
|
IP = #{ip},
|
|
</if>
|
|
<if test="address != null and address != ''">
|
|
ADDRESS = #{address},
|
|
</if>
|
|
<if test="browser != null and browser != ''">
|
|
BROWSER = #{browser},
|
|
</if>
|
|
<if test="os != null and os != ''">
|
|
OS = #{os},
|
|
</if>
|
|
<if test="status != null">
|
|
STATUS = #{status},
|
|
</if>
|
|
<if test="errorMsg != null and errorMsg != ''">
|
|
ERROR_MSG = #{errorMsg},
|
|
</if>
|
|
<if test="createUser != null">
|
|
CREATE_USER = #{createUser},
|
|
</if>
|
|
<if test="updateBy != null and updateBy != ''">
|
|
UPDATE_BY = #{updateBy},
|
|
</if>
|
|
</set>
|
|
where LOG_ID = #{logId}
|
|
</update>
|
|
|
|
<!--通过主键删除-->
|
|
<delete id="deleteById">
|
|
delete from sys_log where LOG_ID = #{logId}
|
|
</delete>
|
|
|
|
</mapper>
|