<?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="org.springblade.modules.mall.mapper.SeckillGoodsMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="seckillGoodsResultMap" type="org.springblade.modules.mall.entity.SeckillGoods">
        <result column="id" property="id"/>
        <result column="is_delete" property="isDelete"/>
        <result column="create_user_id" property="createUserId"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user_id" property="updateUserId"/>
        <result column="update_time" property="updateTime"/>
        <result column="seckill_round_id" property="seckillRoundId"/>
        <result column="goods_id" property="goodsId"/>
        <result column="goods_quantity" property="goodsQuantity"/>
        <result column="rush_num" property="rushNum"/>
    </resultMap>


    <select id="selectSeckillGoodsPage" resultMap="seckillGoodsResultMap">
        select * from biz_seckill_goods where is_deleted = 0
    </select>
    <select id="selectGoods" resultType="org.springblade.modules.mall.vo.SeckillGoodsVO">
        SELECT
            sg.id,
            sg.goods_id,
            sg.seckill_round_id,
            sg.goods_quantity,
            sg.rush_num,
            gi.goods_cover,
            gi.goods_name,
            gi.seckill_price
        FROM
            biz_seckill_goods sg
            JOIN biz_goods_info gi ON sg.goods_id = gi.id
        WHERE
            gi.is_delete = 0 and sg.is_delete = 0 and sg.seckill_round_id = #{seckkillRoundId}
    </select>

</mapper>
