HttpSequenceLogMapper.java
1.97 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
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.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.ecar.apm.model.HttpSequenceLog;
@Mapper
public interface HttpSequenceLogMapper {
@Insert("INSERT INTO http_sequence_log(pguid,`status`,`costTime`,log"
+ ") VALUES("
+"#{httpSequenceLog.pguid},#{httpSequenceLog.status},#{httpSequenceLog.costTime},#{httpSequenceLog.log})")
@Options(useGeneratedKeys = true, keyProperty = "httpSequenceLog.id", keyColumn = "id")
void insert(@Param("httpSequenceLog")HttpSequenceLog httpSequenceLog);
@Select("SELECT * FROM http_sequence_log")
List<HttpSequenceLog> selectAll();
@Select("select t.* from http_sequence_log t where t.pguid=#{pguid}")
HttpSequenceLog getByGuid(@Param("pguid")String pguid);
@Delete("delete from http_sequence_log where pguid=#{pguid}")
void delete(@Param("pguid")String pguid);
@Select("select t.`status` from http_sequence_log t where t.pguid = #{pguid} order by t.createTime desc limit 1")
Object selectRecentStatusByPguid(@Param("pguid")String pguid);
@Select("select t.`status`,count(t.`status`) as count from http_sequence_log t where t.pguid = #{pguid} group by t.`status`")
List<Map<String,Object>> selectUsabilityByPguid(@Param("pguid")String pguid);
@Select("select ROUND(AVG(t.costTime)) as costTime from http_sequence_log t where t.pguid = #{pguid}")
Object selectAvgCostTimeByPguid(@Param("pguid")String pguid);
@Select("select t.id,t.pguid,t.createTime,t.`status`,t.costTime,t.log from http_sequence_log t where t.pguid = #{pguid}")
List<Map<String,Object>> selectLogByPguid(@Param("pguid")String pguid);
@Delete("delete from http_sequence_log where createTime < date_sub(curdate(),interval #{day} day)")
void cleanLogByDay(@Param("day")int day);
}