<?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.xxfc.platform.order.mapper.OrderVehicaleCrosstownMapper">
  <resultMap id="BaseResultMap" type="com.xxfc.platform.order.entity.OrderVehicleCrosstown">
    <!--
      WARNING - @mbg.generated
    -->
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="order_id" jdbcType="INTEGER" property="orderId" />
    <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
    <result column="mileage" jdbcType="INTEGER" property="mileage" />
    <result column="mileage_img" jdbcType="VARCHAR" property="mileageImg" />
    <result column="status" jdbcType="BIT" property="status" />
    <result column="status_time" jdbcType="BIGINT" property="statusTime" />
    <result column="status_name" jdbcType="VARCHAR" property="statusName" />
    <result column="status_id" jdbcType="INTEGER" property="statusId" />
    <result column="is_del" jdbcType="BIT" property="isDel" />
    <result column="imgs" jdbcType="LONGVARCHAR" property="imgs" />
    <result column="remak" jdbcType="LONGVARCHAR" property="remak" />
    <result column="crt_time" jdbcType="BIGINT" property="crtTime" />
    <result column="upd_time" jdbcType="BIGINT" property="updTime" />
    <result column="vehicle_key" jdbcType="LONGVARCHAR" property="vehicleKey"/>
    <result column="deduction" jdbcType="BIT" property="deduction" />
    <result column="ded_detail" jdbcType="LONGVARCHAR" property="dedDetail" />
    <result column="type" jdbcType="INTEGER" property="type"/>
      <result column="deduction_cost" jdbcType="INTEGER" property="deductionCost"/>
      <result column="rest_deposit" jdbcType="INTEGER" property="restDeposit"/>
      <result column="user_license_id" jdbcType="VARCHAR" property="userLicenseId"/>
      <result column="violate_amount_detail" jdbcType="VARCHAR" property="violateDetail"/>
      <result column="user_license_img" jdbcType="VARCHAR" property="userLicenseImg"/>
  </resultMap>
    <resultMap id="orderMap" type="com.xxfc.platform.order.pojo.order.OrderVehicleCrosstownDto">
        <result column="id" javaType="java.lang.Integer" property="id"/>
        <association column="id" property="depositRefundRecord"
                     select="com.xxfc.platform.order.mapper.DepositRefundRecordMapper.selectByCrossId"
                     javaType="com.xxfc.platform.order.entity.DepositRefundRecord"/>
    </resultMap>
    <select id="selectByOrderId" parameterType="com.xxfc.platform.order.pojo.order.OrderVehicleCrosstownDto" resultType="com.xxfc.platform.order.pojo.order.OrderVehicleCrosstownDto">
        select o.*, o.violate_amount_detail violateDetail
        from order_vehicle_crosstown o

        <where>
            <if test="status != null">
                and o.status = #{status}
            </if>
            <if test="type != null">
                and o.type = #{type}
            </if>
            <if test="orderId != null">
                and o.order_id = #{orderId}
            </if>
            <if test="address != null and address== 1">
                and o.type != 1
            </if>
            <if test="orderNo != null">
                and o.order_no = #{orderNo}
            </if>
            <if test="typeList != null and typeList.size() != 0">
                and o.type in
                <foreach collection="typeList" item="type" index="index" open="(" separator="," close=")">
                    #{type}
                </foreach>
            </if>
        </where>
    </select>
    <select id="selectByOrderNo" parameterType="java.util.Map" resultType="com.xxfc.platform.order.pojo.order.OrderVehicleCrosstownDto">
        select *
        from order_vehicle_crosstown
        where order_no = #{no} and type = #{type}
    </select>


</mapper>