<?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.citygis.web.mapper.TabLog2Mapper">

    <select id="getTabLog2List" resultType="com.citygis.web.domain.TabLog2"
            parameterType="com.citygis.web.domain.TabLog2">
        SELECT
        url,
        MAX(time) AS MaxTime,
        status,
        AVG(CAST(responseTime AS INT)) AS AvgResponseTime
        FROM
        test.dbo.tab_log2
        <where>
            <if test="url != null">
                AND url like concat('%',#{url},'%')
            </if>
            <if test="status != null and status == 0">
                AND status = 'HTTP://200'
            </if>
            <if test="status != null and status == 1">
                AND status != 'HTTP://200'
            </if>
        </where>
        GROUP BY
        url, status
    </select>

    <select id="getTabLog2DetailListByUrl" resultType="com.citygis.web.domain.TabLog2"
            parameterType="com.citygis.web.domain.TabLog2">
        SELECT id, url, para, time, reponse, status, responseTime, ip
        FROM test.dbo.tab_log2
        <where>
            url = #{url}
            <if test="startTime != null">
                and time >= #{startTime}
                and time &lt;=#{endTime}
            </if>

        </where>
    </select>

</mapper>
