<?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.OrderViolationMapper">
    <select id="getOrderAndVehicleStatus" parameterType="Integer" resultType="Map">
      select
     b.status,
     b.refund_status as refundStatus
     from
     order_rent_vehicle_detail v
     left join
		 base_order b
     on
     v.order_id=b.id
     where
     v.id=#{vId}
    </select>

    <select id="getOneByDetailId" resultType="com.xxfc.platform.order.entity.OrderViolation" parameterType="java.lang.Integer">
        select * from order_violation
        where detail_id = #{detailId}
    </select>

    <insert id="batchSave" parameterType="list">
        insert into order_violation ( price, detail_id,  violate_date, area, act, is_del)
        VALUES
        <foreach collection="list" item="emp" index="index" separator=",">
            (
            #{emp.price,jdbcType=DECIMAL},
            #{emp.detailId,jdbcType=INTEGER},
            #{emp.violateDate,jdbcType=BIGINT},
            #{emp.area,jdbcType=VARCHAR},
            #{emp.act,jdbcType=VARCHAR},
            #{emp.isDel,jdbcType=INTEGER}
         )
        </foreach>
        ON DUPLICATE KEY UPDATE
        price = values(price),
        detail_id = values(detail_id),
        violate_date = values(violate_date),
        area = values(area),
        act = values(act),
        is_del = values(is_del)
    </insert>

</mapper>