<?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.shkj.wms.mapper.BaseDeriveMapper">

    <resultMap type="com.shkj.wms.domain.BaseDerive" id="BaseDeriveResult">
        <result property="derive" column="derive"/>
        <result property="vehicheCode" column="vehiche_code"/>
        <result property="vehicheModel" column="vehiche_model"/>
        <result property="frontLocation" column="front_location"/>
        <result property="frontSplit" column="front_split"/>
        <result property="rearLocation" column="rear_location"/>
        <result property="rearSplit" column="rear_split"/>
        <result property="frontPunching" column="front_punching"/>
        <result property="rearPunching" column="rear_punching"/>
        <result property="remark" column="remark"/>
        <result property="color" column="color"/>
    </resultMap>

    <select id="selectBaseDeriveListByVehiche" resultMap="BaseDeriveResult" parameterType="com.shkj.wms.bo.BaseBarcodesOutAddBo">
            SELECT
            *
            FROM
            base_derive
            <if test="derive !=null ">
            WHERE
                base_derive.derive =#{derive}
            </if>
            <if test="vehicleCode !=null ">
                AND
                base_derive.vehiche_code =#{vehicleCode}
            </if>
    </select>


    <select id="selectBaseDeriveBybarcodes" resultMap="BaseDeriveResult" parameterType="com.shkj.wms.bo.BaseDeriveQueryBo">
        SELECT * FROM  base_derive
        <where>
            <if test="derive !=null and derive !='' ">
                AND base_derive.derive =#{derive}
            </if>

            <if test="vehicheCode !=null and vehicheCode !='' ">
                AND base_derive.vehiche_code =#{vehicheCode}
            </if>

            <if test="vehicheModel !=null and vehicheModel !='' ">
              AND base_derive.vehiche_model =#{vehicheModel}
            </if>

            <if test="frontLocation !=null and frontLocation !='' ">
                AND base_derive.front_location =#{frontLocation}
            </if>

            <if test="frontSplit !=null and frontSplit !='' ">
                AND base_derive.front_split =#{frontSplit}
            </if>

            <if test="frontPunching !=null and frontPunching !='' ">
                AND base_derive.front_punching =#{frontPunching}
            </if>

            <if test="rearLocation !=null and rearLocation !='' ">
                AND base_derive.rear_location =#{rearLocation}
            </if>

            <if test="rearSplit !=null and rearSplit !='' ">
                AND base_derive.rear_split =#{rearSplit}
            </if>

            <if test="rearPunching !=null and rearPunching !='' ">
                AND base_derive.rear_punching =#{rearPunching}
            </if>
        </where>
        limit 1

    </select>


    <select id="selectBaseDeriveList" resultMap="BaseDeriveResult">
        SELECT
        bd.*
        FROM
        base_derive bd
        where 1 = 1
        <if test="derive !=null ">
            AND
            bd.derive =#{derive}
        </if>
        <if test="vehicheCode !=null ">
            AND
            bd.vehiche_code =#{vehicheCode}
        </if>
    </select>
</mapper>
