<?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.its.vms.dao.mapper.VmsIfscMapper">

    <select id="selectVmsRltnIfsc" resultType="com.its.vms.entity.TbVmsRltnIfsc">
    <![CDATA[
        select a.vms_ctlr_nmbr  AS vmsCtlrNmbr,
               b.vms_ifsc_id    AS vmsIfscId,
               b.dspl_prrt      AS dsplPrrt,
               c.axis_yn        AS axisYn,
               c.cngs_spd       AS cngstSped,
               b.cngs_cnfm_yn   AS cngstCnfmYn,
               b.cngs_cnfm_sped AS cngstCnfmSped
        from tb_vms_ctlr      a,
             tb_vms_rltn_ifsc b,
             tb_vms_ifsc      c
        where a.vms_ctlr_nmbr = b.vms_ctlr_nmbr
          and b.vms_ifsc_id   = c.vms_ifsc_id
          and c.use_yn = 'Y'
          and a.del_yn = 'N'
        order by a.vms_ctlr_nmbr, b.dspl_prrt
        ]]>
    </select>

    <select id="selectVmsIfscTrafInfo" resultType="com.its.vms.entity.TbVmsIfscTraf">
    <![CDATA[
        select a.vms_ifsc_id            AS vmsIfscId,
               a.vms_ifsc_nm            AS vmsIfscNm,
               a.dspl_strt_node_nm      AS dsplStrtNodeNm,
               a.dspl_end_node_nm       AS dsplEndNodeNm,
               a.road_nm                AS roadNm,
               a.spot_nm                AS spotNm,
               a.detr_id                AS detrId,
               a.axis_yn                AS axisYn,
               a.use_yn                 AS useYn,
               a.cngs_spd               AS cntstSped,
               nvl(b.rgst_dt,       '') AS prcnDt,
               nvl(b.cmtr_grad_cd, '0') AS cmtrGradCd,
               nvl(b.sped,           0) AS sped,
               nvl(b.trvl_hh,        0) AS trvlHh
        from tb_vms_ifsc a,
             (select *
              from tb_vms_ifsc_traf
              where rgst_dt >= to_char(sysdate-10/1440, 'yyyymmddhh24miss') ) b
        where a.vms_ifsc_id = b.vms_ifsc_id(+)
        ]]>
    </select>

</mapper>
