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

    <resultMap type="BaseGoodsData" id="BaseGoodsResult">
        <result property="id"    column="id"    />
        <result property="goodsNo"    column="goods_no"    />
        <result property="goodsName"    column="goods_name"    />
        <result property="color"    column="color"    />
        <result property="vehicheModel"    column="vehiche_model"    />
        <result property="location"    column="location"    />
        <result property="isSplit"    column="is_split"    />
        <result property="isPunching"    column="is_punching"    />
        <result property="locationCode"    column="location_code"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updateBy"    column="update_by"    />
    </resultMap>

    <resultMap type="java.util.HashMap" id="ColorResult">
        <result property="color"    column="color"    />
    </resultMap>

    <resultMap type="java.util.HashMap" id="VehicheModelResult">
        <result property="vehicheModel"    column="vehiche_model"    />
    </resultMap>

    <resultMap type="java.util.HashMap" id="DeriveModelResult">
        <result property="derive"    column="derive"    />
    </resultMap>

    <resultMap id="LocationCodeResult" type="java.util.HashMap">
        <result property="locationCode" column="locationCode"/>
    </resultMap>


    <sql id="selectBaseGoodsVo">
        select id, goods_no, goods_name, color, vehiche_model, location, is_split, is_punching, location_code, create_time, create_by, update_time, update_by from base_goods_data
    </sql>



    <select id="getBumperColor" resultMap="ColorResult">
        select distinct color from base_goods_data
    </select>

    <select id="getBumperVehicheModel" resultMap="VehicheModelResult">
        select distinct vehiche_model from base_goods_data
    </select>

    <select id="getBumperDerive" resultMap="DeriveModelResult">
        select distinct derive from base_derive
    </select>

    <select id="getBumperLocationCode" resultMap="LocationCodeResult">
        select distinct location_code from base_goods_data
    </select>


    <select id="getBaseGoodDataInByDerice" resultMap="BaseGoodsResult" parameterType="com.shkj.wms.bo.BaseDeriveQueryBo">
    SELECT * FROM  base_goods_data
    <where>
        <if test="color !=null and color !='' ">
            AND base_goods_data.color =#{color}
        </if>

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

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

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

        <if test="frontLocation !=null and frontLocation != ''">
            AND base_goods_data.location_code = #{frontLocation}
        </if>
    </where>
    </select>

    <select id="getBaseGoodDatarear" resultMap="BaseGoodsResult" parameterType="com.shkj.wms.bo.BaseDeriveQueryBo">
        SELECT * FROM  base_goods_data
        <where>
            <if test="color !=null and color !='' ">
                AND base_goods_data.color =#{color}
            </if>

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

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

            <if test="rearPunching !=null and rearPunching != ''">
                AND base_goods_data.is_punching = #{rearPunching}
            </if>

            <if test="rearLocation !=null and rearLocation != ''">
                AND base_goods_data.location_code = #{rearLocation}
            </if>
        </where>
    </select>


    <select id="getBaseGoodDataNotBarcode" resultMap="BaseGoodsResult" parameterType="com.shkj.wms.bo.BaseBarcodesInQueryBo">
        SELECT * FROM  base_goods_data
        <where>
            <if test="vehicheModel !=null and vehicheModel !='' ">
                AND base_goods_data.vehiche_model =#{vehicheModel}
            </if>

            <if test="color !=null and color !='' ">
                AND base_goods_data.color =#{color}
            </if>

            <if test="isSplit !=null and isSplit !='' ">
                AND base_goods_data.is_split !=#{isSplit}
            </if>

            <if test="locationCode !=null and locationCode !='' ">
                AND base_goods_data.location_code !=#{locationCode}
            </if>

            <if test="isPunching !=null and isPunching !='' ">
                AND base_goods_data.is_punching !=#{isPunching}
            </if>

            <if test="location !=null and location !='' ">
                AND base_goods_data.location !=#{location}
            </if>

            <if test="orientation !=null and orientation !='' ">
                AND base_goods_data.orientation !=#{orientation}
            </if>
        </where>
    </select>



</mapper>
