2021-12-26 19:28:11 +08:00
|
|
|
<?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">
|
2022-01-08 16:59:16 +08:00
|
|
|
<mapper namespace="com.xjs.apilog.mapper.ApiLogMapper">
|
2022-03-25 21:26:55 +08:00
|
|
|
|
2022-01-08 16:59:16 +08:00
|
|
|
<resultMap type="com.xjs.apilog.domain.ApiLog" id="ApiLogResult">
|
2021-12-26 19:28:11 +08:00
|
|
|
<result property="id" column="id" />
|
|
|
|
|
<result property="apiName" column="api_name" />
|
|
|
|
|
<result property="url" column="url" />
|
|
|
|
|
<result property="method" column="method" />
|
|
|
|
|
<result property="request" column="request" />
|
|
|
|
|
<result property="response" column="response" />
|
|
|
|
|
<result property="isSuccess" column="is_success" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
|
|
|
|
<sql id="selectApiLogVo">
|
2021-12-27 20:29:04 +08:00
|
|
|
select id, api_name, url, method, request, response, is_success , create_time from api_log
|
2021-12-26 19:28:11 +08:00
|
|
|
</sql>
|
|
|
|
|
|
2022-01-08 16:59:16 +08:00
|
|
|
<select id="selectApiLogList" parameterType="com.xjs.apilog.domain.ApiLog" resultMap="ApiLogResult">
|
2021-12-26 19:28:11 +08:00
|
|
|
<include refid="selectApiLogVo"/>
|
2021-12-28 22:01:05 +08:00
|
|
|
<where>
|
2021-12-26 19:28:11 +08:00
|
|
|
<if test="apiName != null and apiName != ''"> and api_name like concat('%', #{apiName}, '%')</if>
|
2022-01-22 00:50:13 +08:00
|
|
|
<if test="url != null and url != ''"> and url like concat('%', #{url}, '%')</if>
|
|
|
|
|
<if test="method != null and method != ''"> and method like concat('%', #{method}, '%')</if>
|
|
|
|
|
<if test="request != null and request != ''"> and request like concat('%', #{request}, '%')</if>
|
|
|
|
|
<if test="response != null and response != ''"> and response like concat('%', #{response}, '%')</if>
|
2021-12-26 19:28:11 +08:00
|
|
|
<if test="isSuccess != null "> and is_success = #{isSuccess}</if>
|
2022-01-22 00:50:13 +08:00
|
|
|
<if test="createTime != null and endCreateTime != null"> and create_time between #{createTime} and #{endCreateTime}</if>
|
2021-12-26 19:28:11 +08:00
|
|
|
</where>
|
2022-03-25 21:26:55 +08:00
|
|
|
order by create_time desc
|
2021-12-26 19:28:11 +08:00
|
|
|
</select>
|
2022-03-25 21:26:55 +08:00
|
|
|
|
2021-12-26 19:28:11 +08:00
|
|
|
<select id="selectApiLogById" parameterType="Long" resultMap="ApiLogResult">
|
|
|
|
|
<include refid="selectApiLogVo"/>
|
|
|
|
|
where id = #{id}
|
|
|
|
|
</select>
|
2022-04-06 09:53:49 +08:00
|
|
|
<select id="statisticsByDate" resultType="com.xjs.apilog.vo.ApiLogVo">
|
|
|
|
|
select api_name ,count(api_name) count FROM
|
|
|
|
|
(select api_name from api_log where
|
|
|
|
|
create_time BETWEEN #{startDate} and #{endDate}) t
|
|
|
|
|
GROUP BY api_name
|
|
|
|
|
</select>
|
2021-12-26 19:28:11 +08:00
|
|
|
|
|
|
|
|
<delete id="deleteApiLogById" parameterType="Long">
|
|
|
|
|
delete from api_log where id = #{id}
|
|
|
|
|
</delete>
|
|
|
|
|
|
2021-12-26 22:14:30 +08:00
|
|
|
<delete id="deleteApiLogByIds" parameterType="Long">
|
2022-03-25 21:26:55 +08:00
|
|
|
delete from api_log where id in
|
2021-12-26 19:28:11 +08:00
|
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
|
|
|
#{id}
|
|
|
|
|
</foreach>
|
|
|
|
|
</delete>
|
2022-03-25 21:26:55 +08:00
|
|
|
</mapper>
|