<?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.xxfc.platform.activity.mapper.ActivityPrizeMapper">

	<!-- 可根据自己的需求，是否要使用 -->
    <resultMap type="com.xxfc.platform.activity.entity.ActivityPrize" id="activityPrizeMap">
        <result property="id" column="id"/>
        <result property="serialNumber" column="serial_number"/>
        <result property="name" column="name"/>
        <result property="iconPath" column="icon_path"/>
        <result property="dayMaxUse" column="day_max_use"/>
        <result property="totalStock" column="total_stock"/>
        <result property="probability" column="probability"/>
        <result property="type" column="type"/>
        <result property="crtTime" column="crt_time"/>
        <result property="goodsId" column="goods_id"/>
        <result property="prizeGoodsType" column="prize_goods_type"/>
    </resultMap>

    <update id="updatePrizeStock">
        update `activity_prize` set `total_stock`=`total_stock`-1 where `type`=#{prizeType} and `serial_number`=#{serialNumber} and `total_stock`>0;
    </update>

</mapper>