<?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.common.mapper.XdrHoneypotMapper">

    <resultMap id="xdrHoneypotResultMap" type="com.common.entity.XdrHoneypot">
        <id property="id" column="id"/>
        <result property="vcsource" column="vcsource"/>
        <result property="dstartTime" column="dstart_time"/>
        <result property="dtime" column="dtime"/>
        <result property="riskLevel" column="risk_level"/>
        <result property="vcconnection" column="vcconnection"/>
        <result property="fileInfo" column="file_info"/>
        <result property="extra" column="extra"/>
        <result property="vctype" column="vctype"/>
        <result property="agentSn" column="agent_sn"/>
        <result property="agentName" column="agent_name"/>
        <result property="honeypotId" column="honeypot_id"/>
        <result property="honeypotName" column="honeypot_name"/>
        <result property="srcIp" column="src_ip"/>
        <result property="srcPort" column="src_port"/>
        <result property="srcMac" column="src_mac"/>
        <result property="destIp" column="dest_ip"/>
        <result property="destPort" column="dest_port"/>
        <result property="proxyIp" column="proxy_ip"/>
        <result property="node" column="node"/>
    </resultMap>

    <!-- 批量插入 -->
    <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
        INSERT INTO xdr_honeypot (
        vcsource, dstart_time, dtime, risk_level, vcconnection,
        file_info, extra, vctype, agent_sn, agent_name,
        honeypot_id, honeypot_name, src_ip, src_port, src_mac,
        dest_ip, dest_port, proxy_ip, node
        ) VALUES
        <foreach collection="list" item="item" index="index" separator=",">
            (
            #{item.vcsource}, #{item.dstartTime}, #{item.dtime}, #{item.riskLevel}, #{item.vcconnection},
            #{item.fileInfo}, #{item.extra}, #{item.vctype}, #{item.agentSn}, #{item.agentName},
            #{item.honeypotId}, #{item.honeypotName}, #{item.srcIp}, #{item.srcPort}, #{item.srcMac},
            #{item.destIp}, #{item.destPort}, #{item.proxyIp}, #{item.node}
            )
        </foreach>
    </insert>

</mapper>