<?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.liquidnet.service.goblin.mapper.GoblinNftExSkuMapper">
    <resultMap id="BaseResult" type="com.liquidnet.service.goblin.entity.GoblinNftExSku">
        <result column="activity_id" property="activityId" jdbcType="VARCHAR"/>
        <result column="sku_id" property="skuId" jdbcType="VARCHAR"/>
        <result column="store_id" property="storeId" jdbcType="VARCHAR"/>
        <result column="spu_id" property="spuId" jdbcType="VARCHAR"/>
        <result column="unbox" property="unbox" jdbcType="VARCHAR"/>
        <result column="ex_stock" property="exStock" jdbcType="INTEGER"/>
        <result column="ex_limit" property="exLimit" jdbcType="INTEGER"/>
        <result column="ex_start_time" property="exStartTime" jdbcType="TIMESTAMP"/>
        <result column="ex_stop_time" property="exStopTime" jdbcType="TIMESTAMP"/>
        <result column="created_at" property="createdAt" jdbcType="TIMESTAMP"/>
        <result column="updated_at" property="updatedAt" jdbcType="TIMESTAMP"/>
    </resultMap>

    <select id="selectGoblinNftExSkuByActivityIds" resultMap="BaseResult">
        select activity_id,sku_id,unbox,store_id,ex_start_time,ex_stop_time from goblin_nft_ex_sku where
            activity_id in
            <foreach collection="activityIds.split(',')" item="activityId" open="(" separator="," close=")" >
                #{activityId,jdbcType=VARCHAR}
            </foreach>
    </select>

    <insert id="addGoblinNftExSkus">
        insert into goblin_nft_ex_sku (activity_id,spu_id,sku_id,store_id,unbox,ex_stock,ex_limit,ex_start_time,ex_stop_time,created_at)
        values
        <foreach collection="goblinNftExSkus" item="goblinNftExSku" separator=",">
            (
            #{goblinNftExSku.activityId},
            #{goblinNftExSku.spuId},
            #{goblinNftExSku.skuId},
            #{goblinNftExSku.storeId},
            #{goblinNftExSku.unbox},
            #{goblinNftExSku.exStock},
            #{goblinNftExSku.exLimit},
            #{goblinNftExSku.exStartTime},
            #{goblinNftExSku.exStopTime},
            #{goblinNftExSku.createdAt}
            )
        </foreach>
    </insert>
</mapper>
