<?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.zjrs.ggfw.portal.entity.EMSMapper">

    <select id="queryNeedOrder" resultType="com.zjrs.ggfw.portal.dto.EMSOrderDTO">
        select a.custOrderId, b.sjrxm as tcontactor,b.sjrsj as tcustMobile,sjrdz as tcustAddress,
        (select area_name from aa16 where id = b.tcustProvince) as tcustProvince,
        (select area_name from aa16 where id = b.tcustCity) as tcustCity,
        (select area_name from aa16 where id = b.tcustCounty) as tcustCounty,
        c.scontactor,c.scustMobile,c.scustProvince,c.scustCity,c.scustCounty,c.scustAddress
        from RS_SLXX_EMS_ORDER a,RS_SLXX b,RS_SX_CONFIG c where a.sllsh = b.sllsh 
        and a.orderStatus is null
    </select>

    <select id="queryNeedZfSx" resultType="com.zjrs.ggfw.portal.dto.EMSOrderDTO">
        select a.custOrderId, b.sjrxm as tcontactor,b.sjrsj as tcustMobile,sjrdz as tcustAddress,b.tcustProvince,b.tcustCity,b.tcustCounty,
        c.scontactor,c.scustMobile,c.scustProvince,c.scustCity,c.scustCounty,c.scustAddress
        from RS_SLXX_EMS_ORDER a,RS_SLXX b,RS_SX_CONFIG c where a.sllsh = b.sllsh 
        and a.sllsh = #{sllsh} 
    </select>

    <select id="queryOrderXx" resultType="com.zjrs.ggfw.portal.dto.EMSORderXxDTO">
        select to_char(to_date(a.paytime,'yyyymmddhh24miss'),'yyyy-mm-dd hh24:mi:ss') as paytime,a.custOrderId,
        a.orderStatus,a.sllsh, NULL slbh,a.postfee,a.xdsj,b.sjrxm as tcontactor,NULL tcustmobile,
        b.sjrdz as tcustaddress,
        b.tcustProvince as tcustProvinceCode,b.tcustCity as tcustCityCode,b.tcustCounty as tcustCountyCode,
        b.sjrdz as sjaddress,
        NULL as tcustprovince,
        (select area_name from aa16 where id = b.tcustCity) as tcustcity,
        (select area_name from aa16 where id = b.tcustCounty) as tcustcounty
        from RS_SLXX_EMS_ORDER a,RS_SLXX b,RS_SX_CONFIG c where a.sllsh = b.sllsh 
        and a.sllsh = #{dto.sllsh}
    </select>
</mapper>
