<?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.sale.wares.mapper.BdWaresExtendMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.hzs.common.domain.sale.wares.BdWaresExtend">
        <id column="PK_ID" property="pkId" />
        <result column="PK_CREATOR" property="pkCreator" />
        <result column="CREATION_TIME" property="creationTime" />
        <result column="PK_MODIFIED" property="pkModified" />
        <result column="MODIFIED_TIME" property="modifiedTime" />
        <result column="DEL_FLAG" property="delFlag" />
        <result column="PK_COUNTRY" property="pkCountry" />
        <result column="PK_WARES" property="pkWares" />
        <result column="IS_PUT_ON" property="isPutOn" />
        <result column="PRE_SALE_STATUS" property="preSaleStatus" />
        <result column="PUT_ON_TIME" property="putOnTime" />
        <result column="PUT_OFF_TIME" property="putOffTime" />
        <result column="OPERATE_SCOPE" property="operateScope" />
        <result column="PREFIX_LABEL" property="prefixLabel" />
        <result column="COOL_LABEL" property="coolLabel" />
        <result column="S_LABEL" property="sLabel" />
        <result column="SALES" property="sales" />
        <result column="IS_SALE" property="isSale" />
        <result column="ARRIVAL_TIME" property="arrivalTime" />
        <result column="WARN_MESSAGE" property="warnMessage" />
        <result column="IS_LAND_TRANS" property="isLandTrans" />
        <result column="PK_LAND_POSTAGE" property="pkLandPostage"/>
        <result column="IS_AIR_TRANS" property="isAirTrans"/>
        <result column="PK_AIR_POSTAGE" property="pkAirPostage"/>
        <result column="IS_OCEAN_TRANS" property="isOceanTrans"/>
        <result column="PK_OCEAN_POSTAGE" property="pkOceanPostage"/>
        <result column="SELLING_POINTS" property="sellingPoints"/>
        <result column="IS_MAKER_GIFT" property="isMakerGift"/>
        <result column="PK_SPECIAL_CURRENCY" property="pkSpecialCurrency"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        PK_CREATOR,
        CREATION_TIME,
        PK_MODIFIED,
        MODIFIED_TIME,
        DEL_FLAG,
        PK_COUNTRY,
        PK_ID, PK_WARES, IS_PUT_ON, PRE_SALE_STATUS, PUT_ON_TIME, PUT_OFF_TIME, OPERATE_SCOPE, PREFIX_LABEL, COOL_LABEL, S_LABEL, SALES, IS_SALE, ARRIVAL_TIME, WARN_MESSAGE,
        IS_LAND_TRANS,PK_LAND_POSTAGE,IS_AIR_TRANS,PK_AIR_POSTAGE,IS_OCEAN_TRANS,PK_OCEAN_POSTAGE,SELLING_POINTS
    </sql>

    <select id="updateWaresSalesAccrual">
        <foreach collection="waresNumberList" item="item" index="index" open="" close="" separator=";">
            update BD_WARES_EXTEND
            <set>
                SALES=SALES+#{item.number}
            </set>
            where PK_WARES = #{item.pkWares}
        </foreach>
    </select>

    <update id="updatePutOnTime">
          update BD_WARES_EXTEND  set PUT_ON_TIME = null   where PK_WARES = #{waresId}
    </update>

    <update id="updatePutOffTime">
        update BD_WARES_EXTEND  set PUT_OFF_TIME = null   where PK_WARES = #{waresId}
    </update>
</mapper>
