<?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.OrderRentVehicleDetailMapper">

    <select id="listByOrderId" parameterType="Integer" resultType="com.xxfc.platform.order.entity.OrderRentVehicleDetail">
        select *
        from order_rent_vehicle_detail
        where order_id = #{orderId}
    </select>

    <select id="oneByOrderId" parameterType="Integer" resultType="map">
        select *
        from order_rent_vehicle_detail
        where order_id = #{orderId} limit 1 offset 0;
    </select>

    <select id="getPScore" resultType="Integer" >
        SELECT round(IFNULL (AVG(score),0)) score  FROM  order_rent_vehicle_detail  WHERE model_id=#{modelId}
     </select>

    <select id="pageByParm" parameterType="Map" resultType="com.xxfc.platform.order.entity.OrderRentVehicleDetail">
        select *
        from order_rent_vehicle_detail
        <where>
            <if test="id != null">
                and id = #{id}
            </if>
            <if test="startCompanyId != null">
                and start_company_id = #{startCompanyId}
            </if>
            <if test="endCompanyId != null">
                and end_company_id = #{endCompanyId}
            </if>
        </where>
        order by crt_time desc
    </select>
</mapper>