<?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.hzs.activity.pick.mapper.AcRetailPickProductMapper">

    <!-- 提货产品列表 -->
    <select id="listPickProduct" resultType="com.hzs.common.domain.activity.pick.ext.AcRetailPickProductExt">
        select arpp.*, bp.product_name, bp.cover, bp.product_code
        from AC_RETAIL_PICK_PRODUCT arpp
        inner join bd_product bp
        on bp.pk_id = arpp.pk_product
        where arpp.is_put_on = 0
        and arpp.pk_country = #{pkCountry}
        and arpp.system_type = #{systemType}
        <if test="pkIdList != null and pkIdList.size > 0">
            and arpp.pk_id in
            <foreach collection="pkIdList" item="item" open="(" separator="," close=")">
                #{item}
            </foreach>
        </if>
        order by arpp.creation_time desc
    </select>

    <select id="retailPickProductList" resultType="com.hzs.common.domain.activity.pick.ext.AcRetailPickProductExt">
        select arpp.*,
        bp.product_name,
        bp.PRODUCT_CODE productCode
        from AC_RETAIL_PICK_PRODUCT arpp
        inner join bd_product bp
        on bp.pk_id = arpp.pk_product
        where arpp.DEL_FLAG= 0
        and arpp.pk_country = #{pkCountry}
        and arpp.system_type = #{systemType}
        <if test="isPutOn!=null">
            and arpp.IS_PUT_ON=#{isPutOn}
        </if>
        <if test="productCode != null and productCode != ''">
            and bp.PRODUCT_CODE like #{productCode} || '%'
        </if>
        <if test="productName != null and productName != ''">
            and bp.PRODUCT_NAME like #{productName} || '%'
        </if>
        order by arpp.creation_time desc
    </select>


</mapper>
