HttpRequestLogMapper.java
1.41 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
package com.ecar.apm.dao;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.ecar.apm.model.HttpRequestLog;
@Mapper
public interface HttpRequestLogMapper {
@Insert("INSERT INTO http_request_log(pid,ppguid,pguid,`status`,`costTime`,`statusCode`,log"
+ ") VALUES("
+"#{httpRequestLog.pid},#{httpRequestLog.ppguid},#{httpRequestLog.pguid},#{httpRequestLog.status},#{httpRequestLog.costTime},"
+ "#{httpRequestLog.statusCode},#{httpRequestLog.log})")
void insert(@Param("httpRequestLog")HttpRequestLog httpRequestLog);
@Select("SELECT * FROM http_request_log")
List<HttpRequestLog> selectAll();
@Select("select t.* from http_request_log t where t.pguid=#{pguid}")
HttpRequestLog getByGuid(@Param("pguid")String pguid);
@Delete("delete from http_request_log where ppguid=#{ppguid}")
void delete(@Param("ppguid")String ppguid);
@Select("select r.httpMethod,r.url,t.`status`,t.statusCode,t.costTime,t.log from http_request_log t,http_request r where t.pguid=r.guid and t.pid=#{id}")
List<Map<String,Object>> getByPid(@Param("id")int id);
@Delete("delete from http_request_log where createTime < date_sub(curdate(),interval #{day} day)")
void cleanLogByDay(@Param("day")int day);
}