<?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.GoblinGoodsSkuMapper">
    <resultMap id="BaseResult" type="com.liquidnet.service.goblin.entity.GoblinGoodsSku">
        <result column="spu_id" property="spuId" jdbcType="VARCHAR"/>
        <result column="sku_id" property="skuId" jdbcType="VARCHAR"/>
        <result column="sku_pic" property="skuPic" jdbcType="VARCHAR"/>
        <result column="name" property="name" jdbcType="VARCHAR"/>
        <result column="unbox" property="unbox" jdbcType="VARCHAR"/>
        <result column="hit_ratio" property="hitRatio" jdbcType="DECIMAL"/>
        <result column="sku_type" property="skuType" jdbcType="INTEGER"/>
        <result column="status" property="status" jdbcType="VARCHAR"/>
        <result column="shelves_status" property="shelvesStatus" jdbcType="VARCHAR"/>
        <result column="sale_stop_time" property="saleStopTime" jdbcType="TIMESTAMP"/>
        <result column="sku_appear" property="skuAppear" jdbcType="VARCHAR"/>
        <result column="sku_canbuy" property="skuCanbuy" jdbcType="VARCHAR"/>
        <result column="del_flg" property="delFlg" jdbcType="VARCHAR"/>
        <result column="soldout_status" property="soldoutStatus" jdbcType="VARCHAR"/>
        <result column="sale_start_time" property="saleStartTime" jdbcType="TIMESTAMP"/>
    </resultMap>

    <select id="selectSkuLikeName" resultMap="BaseResult">
        select sku_id from goblin_goods_sku
        where
        <bind name="likeSkuName" value="'%'+skuName+'%'"/>
        name like #{likeSkuName}
    </select>

    <select id="selectBySkuIds" resultMap="BaseResult">
        select sku_id,name,sku_pic,sale_stop_time,hit_ratio,unbox,sku_type,status,shelves_status,sku_canbuy,sku_appear,del_flg,soldout_status,sale_start_time from goblin_goods_sku where
        sku_id in
        <foreach collection="skuIds.split(',')" item="skuId" open="(" separator="," close=")">
            #{skuId,jdbcType=VARCHAR}
        </foreach>
    </select>

    <select id="selectBySpuIds" resultMap="BaseResult">
        select spu_id,sku_id,sale_stop_time,hit_ratio,unbox,sku_type,status,shelves_status,sku_appear,del_flg,sku_canbuy,soldout_status,sale_start_time from goblin_goods_sku where
        spu_id in
        <foreach collection="spuIds.split(',')" item="spuId" open="(" separator="," close=")">
            #{spuId,jdbcType=VARCHAR}
        </foreach>
    </select>

</mapper>
