<?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.TabIpResultMapper">

    <select id="getTabIpResultList" resultType="com.citygis.web.domain.TabIpResult"
            parameterType="com.citygis.web.domain.TabIpResult">
        select "DESCRIPTION","RESULT",MAX("CREATE_TIME") createTime
        from "LIU_TONG_YI"."TAB_IP_RESULT"
        <where>
            <if test="description != null">
                DESCRIPTION like concat('%',#{description},'%')
            </if>
        </where>
        group by
        "DESCRIPTION",
        "RESULT",
        "IP",
        "PORT"

    </select>

    <select id="getTabIpResultDetailByIpAndPort" resultType="com.citygis.web.domain.TabIpResult"
            parameterType="com.citygis.web.domain.TabIpResult">
        select "ID","IP","PORT","TYPE","RESULT","CREATE_TIME","DESCRIPTION"
        from "LIU_TONG_YI"."TAB_IP_RESULT"
        where IP = #{ip}
        <if test="port != null">
            and PORT = #{port}
        </if>
        <if test="startTime != null">
            and CREATE_TIME >= #{startTime}
            and CREATE_TIME &lt;= #{endTime}
        </if>


    </select>

</mapper>
