<?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.utic.center.utic.traf.server.dao.mapper.dwdb.DwdbTrafficMapper">

    <insert id="insertTrafficCenterHist" timeout="60">
        <![CDATA[
        INSERT /*+ APPEND PARALLEL(TRAFFIC_CENTER_${yyMm}, 2) */ INTO TRAFFIC_CENTER_${yyMm} NOLOGGING (
                        regdate        ,
                        linkid         ,
                        missvalueyn    ,
                        linklevel      ,
                        speed          ,
                        traveltime     ,
                        trafficgrade   ,
                        incidentid     ,
                        datarestype    ,
                        centerid       ,
                        psdmissvalueyn ,
                        psdspeed       ,
                        knnspeed       ,
                        knncnt
                        )
        VALUES(
            TO_DATE(#{obj.regDate}, 'YYYYMMDDHH24MISS'),
            #{obj.linkId},
            #{obj.missValueYn, jdbcType=NULL},
            #{obj.linkLevel},
            #{obj.speed},
            #{obj.travelTime},
            #{obj.trafficGrade},
            #{obj.incidentId, jdbcType=NULL},
            #{obj.dataResType, jdbcType=NULL},
            #{obj.centerId},
            #{obj.psdMissValueYn, jdbcType=NULL},
            DECODE(#{obj.psdSpeed}, 0, NULL, #{obj.psdSpeed}),
            DECODE(#{obj.knnSpeed}, 0, NULL, #{obj.knnSpeed}),
            DECODE(#{obj.knnCnt},   0, NULL, #{obj.knnCnt})
            )
        ]]>
    </insert>

</mapper>
