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

    <!--    <resultMap type="com.shkj.wms.domain.BusinStockMoveD" id="BusinStockMoveDResult">-->
    <!--            <result property="id" column="id"/>-->
    <!--            <result property="orderNo" column="order_no"/>-->
    <!--            <result property="lineId" column="line_id"/>-->
    <!--            <result property="outLocationId" column="out_location_id"/>-->
    <!--            <result property="outContainerCode" column="out_container_code"/>-->
    <!--            <result property="inLocationId" column="in_location_id"/>-->
    <!--            <result property="inContainerCode" column="in_container_code"/>-->
    <!--            <result property="goodId" column="good_id"/>-->
    <!--            <result property="batchId" column="batch_id"/>-->
    <!--            <result property="moveQty" column="move_qty"/>-->
    <!--            <result property="moveCase" column="move_case"/>-->
    <!--            <result property="movePiece" column="move_piece"/>-->
    <!--            <result property="inStockStatus" column="in_stock_status"/>-->
    <!--            <result property="outStockStatus" column="out_stock_status"/>-->
    <!--            <result property="unshelfUser" column="unshelf_user"/>-->
    <!--            <result property="shelfUser" column="shelf_user"/>-->
    <!--            <result property="erpPlanQty" column="erp_plan_qty"/>-->
    <!--            <result property="erpReason" column="erp_reason"/>-->
    <!--            <result property="branchId" column="branch_id"/>-->
    <!--            <result property="sourceOrderNo" column="source_order_no"/>-->
    <!--            <result property="sourceLineId" column="source_line_id"/>-->
    <!--            <result property="reason" column="reason"/>-->
    <!--            <result property="unqualifiedReason" column="unqualified_reason"/>-->
    <!--            <result property="remark" column="remark"/>-->
    <!--            <result property="extend1" column="extend1"/>-->
    <!--            <result property="extend2" column="extend2"/>-->
    <!--            <result property="extend3" column="extend3"/>-->
    <!--            <result property="extend4" column="extend4"/>-->
    <!--            <result property="extend5" column="extend5"/>-->
    <!--            <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>-->
    <select id="queryList" resultType="com.shkj.wms.vo.BusinStockMoveDVo"
            parameterType="com.shkj.wms.bo.BusinStockMoveSQueryBo">

        SELECT
        d.*, g.type,
        g.model,
        g.mold_name
        FROM
        busin_stock_move_d d
        JOIN base_mold g ON d.mold_id = g.id
        WHERE
        1=1
        <if test="moveStatus != null and moveStatus != ''">
            AND d.move_status = #{moveStatus}
        </if>
        <if test="orderNo != null and orderNo != ''">
            d.order_no like concat('%', #{orderNo}, '%')
        </if>
        <if test="moldBarcode != null and moldBarcode != ''">
            AND d.mold_barcode like concat('%', #{moldBarcode}, '%')
        </if>

        <if test="outLocationCode != null and outLocationCode != ''">
            AND d.out_location_code like concat('%', #{outLocationCode}, '%')
        </if>
        <if test="inLocationCode != null and inLocationCode != ''">
            AND d.in_location_code like concat('%', #{inLocationCode}, '%')
        </if>
        <if test="startTime != null">
            AND d.create_time &gt; #{startTime}
        </if>
        <if test="endTime != null">
            AND d.create_time &lt; #{endTime}
        </if>
        order by d.create_time desc

    </select>
</mapper>