ApiLogMapper.xml
2.74 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?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.apilog.mapper.ApiLogMapper">
<resultMap type="com.huaheng.pc.monitor.apilog.domain.ApiLog" id="apiLogResult">
<result property="id" column="id"/>
<result property="apiName" column="apiName"/>
<result property="apiMethod" column="apiMethod"/>
<result property="ip" column="ip"/>
<result property="requestFrom" column="requestFrom"/>
<result property="responseBy" column="responseBy"/>
<result property="url" column="url"/>
<result property="requestTime" column="requestTime"/>
<result property="responseTime" column="responseTime"/>
<result property="requestHeader" column="requestHeader"/>
<result property="requestBody" column="requestBody"/>
<result property="responseHeader" column="responseHeader"/>
<result property="responseBody" column="responseBody"/>
<result property="duration" column="duration"/>
<result property="httpCode" column="httpCode"/>
<result property="retCode" column="retCode"/>
<result property="exception" column="exception"/>
</resultMap>
<sql id="selectapiLogVo">
select id,
apiName,
apiMethod,
ip,
requestFrom,
responseBy,
url,
requestTime,
responseTime,
requestHeader,
requestBody,
responseHeader,
responseBody,
duration,
httpCode,
retCode,
`exception`
from api_log
</sql>
<select id="getRequestFromList" resultType="java.lang.String">
select distinct(requestFrom)
from api_log
order by requestFrom asc
</select>
<select id="getResponseByList" resultType="java.lang.String">
select distinct(responseBy)
from api_log
order by responseBy asc
</select>
<select id="getHttpCodeList" resultType="java.lang.String">
select distinct(httpCode)
from api_log
order by httpCode asc
</select>
<select id="getApiNameList" resultType="java.lang.String">
select distinct(apiName)
from api_log
order by apiName asc
</select>
<select id="getRetCodeList" resultType="java.lang.String">
select distinct(retCode)
from api_log
order by retCode asc
</select>
<delete id="truncateTable">
DELETE
FROM api_log
WHERE requestTime < DATE_SUB(CURDATE(), INTERVAL 15 DAY)
</delete>
</mapper>