<?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.jkcredit.invoice.hub.mapper.CarFreeCarrierBillStartMapper">
    <resultMap id="baseResultMap"
               type="com.jkcredit.invoice.hub.model.po.carFreeCarrierBillStart.CarFreeCarrierBillStartPo">
        <id column="id" property="id"/>
        <result column="plate_color" property="plateColor"/>
        <result column="plate_number" property="plateNumber"/>
        <result column="num" property="num"/>
        <result column="start_time" property="startTime"/>
        <result column="source_addr" property="sourceAddr"/>
        <result column="dest_addr" property="destAddr"/>
        <result column="predict_end_time" property="predictEndTime"/>
        <result column="fee" property="fee"/>
        <result column="title_type" property="titleType"/>
        <result column="tax_player_code" property="taxPlayerCode"/>
        <result column="user_id" property="userId"/>
        <result column="create_time" property="createTime"/>
        <result column="status" property="status"/>
        <result column="is_history" property="isHistory"/>
        <result column="update_time" property="updateTime"/>
        <result column="activated" property="activated"/>
    </resultMap>

    <select id="getBillStartByNum" resultMap="baseResultMap">
        select * from h_car_free_carrier_bill_start where activated = 1 and num = #{num}
    </select>

    <select id="getRealTimeBills" resultMap="baseResultMap">
        select * from h_car_free_carrier_bill_start where activated = 1 and is_history = 1 and (status = 2 or status = 4)
    </select>

    <select id="getHistoryBills" resultMap="baseResultMap">
        select * from h_car_free_carrier_bill_start where activated = 1 and is_history = 2 and (status = 2 or status = 4)
    </select>
</mapper>
