ApiMetricsMapper.xml
2.47 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
<?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.diligrp.xtrade.core.repository.dao.ApiMetricsDao">
<resultMap type="com.diligrp.xtrade.core.repository.entity.ApiMetricsInfoEntity" id="ApiMetricsMap">
<result property="id" column="id"/>
<result property="code" column="code"/>
<result property="message" column="message"/>
<result property="serviceId" column="service_id"/>
<result property="url" column="url"/>
<result property="clientIp" column="client_ip"/>
<result property="requestHeader" column="request_header"/>
<result property="requestBody" column="request_body"/>
<result property="stackTrace" column="stack_trace"/>
<result property="executeTime" column="execute_time"/>
<result property="createdTime" column="created_time"/>
<result property="modifiedTime" column="modified_time"/>
</resultMap>
<insert id="insertBatch" parameterType="java.util.List">
INSERT INTO t_api_metrics(code,
message,
service_id,
url,
client_ip,
request_header,
request_body,
stack_trace,
execute_time,
created_time,
modified_time)
VALUES
<foreach collection="list" item="item" index="index" separator=",">
(
#{item.code},
#{item.message},
#{item.serviceId},
#{item.url},
#{item.clientIp},
#{item.requestHeader},
#{item.requestBody},
#{item.stackTrace},
#{item.executeTime},
#{item.createdTime},
now()
)
</foreach>
</insert>
<!--查询单个-->
<select id="queryById" resultMap="ApiMetricsMap">
select id,
code,
message,
service_id,
url,
request_header,
request_body,
stack_trace,
execute_time,
created_time,
modified_time
from xtrade_gateway.t_api_metrics
where id = #{id}
</select>
</mapper>