<?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.sckw.usual.mapper.KwOrderUsualLandTransportAddressMapper">

    <select id="findByAddress" resultType="com.sckw.usual.entity.KwOrderUsualLandTransportAddress" >
        select
            id, order_id orderId, address_type addressType, `name`, `type`, contacts, phone, city_code cityCode, city_name cityName,
            detail_address detailAddress, lat, lng, fence,  remark, `status`, create_by createBy, create_time createTime,
            update_by updateBy, update_time updateTime
        from kw_order_usual_land_transport_address
        where del_flag = 0
          and order_id = #{lOrderId, jdbcType=BIGINT}
          and address_type = #{addressType, jdbcType=INTEGER}
    </select>

    <select id="findByAddressByOrderId" resultType="com.sckw.usual.entity.KwOrderUsualLandTransportAddress" >
        select
            id, order_id orderId, address_type addressType, `name`, `type`, contacts, phone, city_code cityCode, city_name cityName,
            detail_address detailAddress, lat, lng, fence,  remark, `status`, create_by createBy, create_time createTime,
            update_by updateBy, update_time updateTime
        from kw_order_usual_land_transport_address
        where del_flag = 0
          and order_id = #{lOrderId, jdbcType=BIGINT}
    </select>
    <select id="findByAddressByOrderIds" parameterType="java.util.List" resultType="com.sckw.usual.entity.KwOrderUsualLandTransportAddress">
        select
            id, order_id orderId, address_type addressType, `name`, `type`, contacts, phone, city_code cityCode, city_name cityName,
            detail_address detailAddress, lat, lng, fence,  remark, `status`, create_by createBy, create_time createTime,
            update_by updateBy, update_time updateTime
        from kw_order_usual_land_transport_address
        where del_flag = 0
          and order_id IN (
            <foreach item="orderId" index="index" collection="list" separator=",">
                #{orderId}
            </foreach>
        )
    </select>

</mapper>