<?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.gree.mall.manager.commonmapper.GoodsCheckMapper">

    <select id="checkGoodsSec" resultType="java.lang.Integer">
        SELECT count(DISTINCT ska.sec_kill_id)
        from sec_kill_activity ska
                 LEFT JOIN sec_kill_activity_spec skas on ska.sec_kill_id = skas.sec_kill_id
                 left join goods gs on gs.goods_id = skas.goods_id
        where gs.goods_id = #{goodsId}
          and gs.del = 0
          and gs.status = 1
          and ska.end_time > now()

    </select>


    <select id="checkGoodsSecBatch" resultType="java.lang.String">
        SELECT distinct gs.goods_id from sec_kill_activity ska LEFT JOIN sec_kill_activity_spec skas on
        ska.sec_kill_id=skas.sec_kill_id
        left join goods gs on gs.goods_id = skas.goods_id
        where gs.goods_id in
        <foreach item="item" index="index" collection="goodsIds" open="(" separator=","
                 close=")">
            #{item}
        </foreach>
        and gs.del = 0 and gs.status = 1
        and ska.end_time>now()
    </select>

</mapper>