<?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.prolog.cs.biz.outbound.dao.BillDPrePositionMapper">

        <!-- 通用查询映射结果 -->
        <resultMap id="BaseResultMap" type="com.prolog.cs.biz.outbound.model.entity.BillDPrePositionDO">
                        <!-- id -->
                    <result column="ID" property="id"/>
                        <!-- 订单明细id -->
                    <result column="BILL_D_ID" property="billDId"/>
                        <!-- 波次id -->
                    <result column="WAVE_ID" property="waveId"/>
                        <!-- 商品id -->
                    <result column="ITEM_ID" property="itemId"/>
                        <!-- 订单id -->
                    <result column="BILL_ID" property="billId"/>
                        <!-- 批号 -->
                    <result column="MANUFACTURER_LOT_NUM" property="manufacturerLotNum"/>
                        <!-- 数量 -->
                    <result column="QTY" property="qty"/>
                        <!-- 包装转换数量 -->
                    <result column="CONVERSION_RATE" property="conversionRate"/>
                        <!-- 库位id -->
                    <result column="LOCATION_ID" property="locationId"/>
                        <!-- 库位类型 -->
                    <result column="LOCATION_TYPE" property="locationType"/>
                        <!-- 库区id -->
                    <result column="AREA_ID" property="areaId"/>
                        <!-- 库区编码 -->
                    <result column="AREA_CODE" property="areaCode"/>
                        <!-- 企业id -->
                    <result column="ENTERPRISE_ID" property="enterpriseId"/>
                        <!-- 创建日期 -->
                    <result column="GMT_CREATE" property="gmtCreate"/>
                        <!-- 创建人 -->
                    <result column="CREATOR" property="creator"/>
                        <!-- CREATED_NAME -->
                    <result column="CREATOR_NAME" property="creatorName"/>
                        <!-- 最后修改日期 -->
                    <result column="GMT_MODIFIED" property="gmtModified"/>
                        <!-- 最后修改人 -->
                    <result column="MODIFIER" property="modifier"/>
                        <!-- LAST_UPDATED_NAME -->
                    <result column="MODIFIER_NAME" property="modifierName"/>
                        <!-- 库区类别 -->
                    <result column="AREA_CATEGORY" property="areaCategory"/>
        </resultMap>


        <!-- 通用查询结果列 -->
        <sql id="Base_Column_List">
            t.ID,
            t.BILL_D_ID,
            t.WAVE_ID,
            t.ITEM_ID,
            t.BILL_ID,
            t.MANUFACTURER_LOT_NUM,
            t.QTY,
            t.CONVERSION_RATE,
            t.LOCATION_ID,
            t.LOCATION_TYPE,
            t.AREA_ID,
            t.AREA_CODE,
            t.ENTERPRISE_ID,
            t.GMT_CREATE,
            t.CREATOR,
            t.CREATOR_NAME,
            t.GMT_MODIFIED,
            t.MODIFIER,
            t.MODIFIER_NAME,
            t.AREA_CATEGORY
        </sql>

    <!-- 通用查询语句(数据库comment中含有?则不显示字段注释)) -->
    <sql id="Base_Where_List">


                                        <!-- id查询 -->
                    <if test="params.id != null and params.id != ''">
                        AND t.ID = #{params.id}
                    </if>

                    
                                <!-- id模糊查询 -->
                            <if test="params.idLike != null and params.idLike != ''">
                                AND t.ID LIKE '%' || #{params.idLike} || '%'
                            </if>

                

                                        <!-- 订单明细id查询 -->
                    <if test="params.billDId != null and params.billDId != ''">
                        AND t.BILL_D_ID = #{params.billDId}
                    </if>

                    
                                <!-- 订单明细id模糊查询 -->
                            <if test="params.billDIdLike != null and params.billDIdLike != ''">
                                AND t.BILL_D_ID LIKE '%' || #{params.billDIdLike} || '%'
                            </if>

                

                                        <!-- 波次id查询 -->
                    <if test="params.waveId != null and params.waveId != ''">
                        AND t.WAVE_ID = #{params.waveId}
                    </if>

                    
                                <!-- 波次id模糊查询 -->
                            <if test="params.waveIdLike != null and params.waveIdLike != ''">
                                AND t.WAVE_ID LIKE '%' || #{params.waveIdLike} || '%'
                            </if>

                

                                        <!-- 商品id查询 -->
                    <if test="params.itemId != null and params.itemId != ''">
                        AND t.ITEM_ID = #{params.itemId}
                    </if>

                    
                                <!-- 商品id模糊查询 -->
                            <if test="params.itemIdLike != null and params.itemIdLike != ''">
                                AND t.ITEM_ID LIKE '%' || #{params.itemIdLike} || '%'
                            </if>

                

                                        <!-- 订单id查询 -->
                    <if test="params.billId != null and params.billId != ''">
                        AND t.BILL_ID = #{params.billId}
                    </if>

                    
                                <!-- 订单id模糊查询 -->
                            <if test="params.billIdLike != null and params.billIdLike != ''">
                                AND t.BILL_ID LIKE '%' || #{params.billIdLike} || '%'
                            </if>

                

                                        <!-- 批号查询 -->
                    <if test="params.manufacturerLotNum != null and params.manufacturerLotNum != ''">
                        AND t.MANUFACTURER_LOT_NUM = #{params.manufacturerLotNum}
                    </if>

                    
                                <!-- 批号模糊查询 -->
                            <if test="params.manufacturerLotNumLike != null and params.manufacturerLotNumLike != ''">
                                AND t.MANUFACTURER_LOT_NUM LIKE '%' || #{params.manufacturerLotNumLike} || '%'
                            </if>

                

                                        <!-- 数量查询 -->
                    <if test="params.qty != null and params.qty != ''">
                        AND t.QTY = #{params.qty}
                    </if>

                    
                

                                        <!-- 包装转换数量查询 -->
                    <if test="params.conversionRate != null and params.conversionRate != ''">
                        AND t.CONVERSION_RATE = #{params.conversionRate}
                    </if>

                    
                

                                        <!-- 库位id查询 -->
                    <if test="params.locationId != null and params.locationId != ''">
                        AND t.LOCATION_ID = #{params.locationId}
                    </if>

                    
                                <!-- 库位id模糊查询 -->
                            <if test="params.locationIdLike != null and params.locationIdLike != ''">
                                AND t.LOCATION_ID LIKE '%' || #{params.locationIdLike} || '%'
                            </if>

                

                                        <!-- 库位类型查询 -->
                    <if test="params.locationType != null and params.locationType != ''">
                        AND t.LOCATION_TYPE = #{params.locationType}
                    </if>

                    
                                <!-- 库位类型模糊查询 -->
                            <if test="params.locationTypeLike != null and params.locationTypeLike != ''">
                                AND t.LOCATION_TYPE LIKE '%' || #{params.locationTypeLike} || '%'
                            </if>

                

                                        <!-- 库区id查询 -->
                    <if test="params.areaId != null and params.areaId != ''">
                        AND t.AREA_ID = #{params.areaId}
                    </if>

                    
                                <!-- 库区id模糊查询 -->
                            <if test="params.areaIdLike != null and params.areaIdLike != ''">
                                AND t.AREA_ID LIKE '%' || #{params.areaIdLike} || '%'
                            </if>

                

                                        <!-- 库区编码查询 -->
                    <if test="params.areaCode != null and params.areaCode != ''">
                        AND t.AREA_CODE = #{params.areaCode}
                    </if>

                    
                                <!-- 库区编码模糊查询 -->
                            <if test="params.areaCodeLike != null and params.areaCodeLike != ''">
                                AND t.AREA_CODE LIKE '%' || #{params.areaCodeLike} || '%'
                            </if>

                

                                        <!-- 企业id查询 -->
                    <if test="params.enterpriseId != null and params.enterpriseId != ''">
                        AND t.ENTERPRISE_ID = #{params.enterpriseId}
                    </if>

                    
                                <!-- 企业id模糊查询 -->
                            <if test="params.enterpriseIdLike != null and params.enterpriseIdLike != ''">
                                AND t.ENTERPRISE_ID LIKE '%' || #{params.enterpriseIdLike} || '%'
                            </if>

                

                
                                        <!-- 创建日期开始时间查询 -->
                    <if test="params.gmtCreateStart != null and params.gmtCreateStart != ''">
                        AND t.GMT_CREATE &gt;= to_date(#{params.gmtCreateStart}, 'yyyy-mm-dd HH24:MI:SS')
                    </if>

                        <!-- 创建日期结束时间查询 -->
                    <if test="params.gmtCreateEnd != null and params.gmtCreateEnd != ''">
                        AND t.GMT_CREATE &lt;= to_date(#{params.gmtCreateEnd}, 'yyyy-mm-dd HH24:MI:SS')
                    </if>


                                        <!-- 创建人查询 -->
                    <if test="params.creator != null and params.creator != ''">
                        AND t.CREATOR = #{params.creator}
                    </if>

                    
                                <!-- 创建人模糊查询 -->
                            <if test="params.creatorLike != null and params.creatorLike != ''">
                                AND t.CREATOR LIKE '%' || #{params.creatorLike} || '%'
                            </if>

                

                                        <!-- CREATED_NAME查询 -->
                    <if test="params.creatorName != null and params.creatorName != ''">
                        AND t.CREATOR_NAME = #{params.creatorName}
                    </if>

                    
                                <!-- CREATED_NAME模糊查询 -->
                            <if test="params.creatorNameLike != null and params.creatorNameLike != ''">
                                AND t.CREATOR_NAME LIKE '%' || #{params.creatorNameLike} || '%'
                            </if>

                

                
                                        <!-- 最后修改日期开始时间查询 -->
                    <if test="params.gmtModifiedStart != null and params.gmtModifiedStart != ''">
                        AND t.GMT_MODIFIED &gt;= to_date(#{params.gmtModifiedStart}, 'yyyy-mm-dd HH24:MI:SS')
                    </if>

                        <!-- 最后修改日期结束时间查询 -->
                    <if test="params.gmtModifiedEnd != null and params.gmtModifiedEnd != ''">
                        AND t.GMT_MODIFIED &lt;= to_date(#{params.gmtModifiedEnd}, 'yyyy-mm-dd HH24:MI:SS')
                    </if>


                                        <!-- 最后修改人查询 -->
                    <if test="params.modifier != null and params.modifier != ''">
                        AND t.MODIFIER = #{params.modifier}
                    </if>

                    
                                <!-- 最后修改人模糊查询 -->
                            <if test="params.modifierLike != null and params.modifierLike != ''">
                                AND t.MODIFIER LIKE '%' || #{params.modifierLike} || '%'
                            </if>

                

                                        <!-- LAST_UPDATED_NAME查询 -->
                    <if test="params.modifierName != null and params.modifierName != ''">
                        AND t.MODIFIER_NAME = #{params.modifierName}
                    </if>

                    
                                <!-- LAST_UPDATED_NAME模糊查询 -->
                            <if test="params.modifierNameLike != null and params.modifierNameLike != ''">
                                AND t.MODIFIER_NAME LIKE '%' || #{params.modifierNameLike} || '%'
                            </if>

                

                                        <!-- 库区类别查询 -->
                    <if test="params.areaCategory != null and params.areaCategory != ''">
                        AND t.AREA_CATEGORY = #{params.areaCategory}
                    </if>

                    
                                <!-- 库区类别模糊查询 -->
                            <if test="params.areaCategoryLike != null and params.areaCategoryLike != ''">
                                AND t.AREA_CATEGORY LIKE '%' || #{params.areaCategoryLike} || '%'
                            </if>

                    </sql>
<!--
    &lt;!&ndash; BillDPrePositionVO查询语句 &ndash;&gt;
    <select id="queryBillDPrePositionVOByParams" parameterType="java.util.Map" resultType="com.prolog.cs.biz.outbound.vo.BillDPrePositionVO">
        SELECT
        <include refid="Base_Column_List"/>
        FROM WMS_WAVE_BILL_D_PRE_POSITION t
        <where>
            <include refid="Base_Where_List"/>
        </where>
    </select>
    -->
</mapper>
