|  | @@ -0,0 +1,130 @@
 | 
	
		
			
				|  |  | +<?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.fs.live.mapper.LiveLotteryProductConfMapper">
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <resultMap type="LiveLotteryProductConf" id="LiveLotteryProductConfResult">
 | 
	
		
			
				|  |  | +        <result property="id"    column="id"    />
 | 
	
		
			
				|  |  | +        <result property="lotteryId"    column="lottery_id"    />
 | 
	
		
			
				|  |  | +        <result property="liveId"    column="live_id"    />
 | 
	
		
			
				|  |  | +        <result property="productId"    column="product_id"    />
 | 
	
		
			
				|  |  | +        <result property="prizeLevel"    column="prize_level"    />
 | 
	
		
			
				|  |  | +        <result property="perLotteryNum"    column="per_lottery_num"    />
 | 
	
		
			
				|  |  | +        <result property="totalLots"    column="total_lots"    />
 | 
	
		
			
				|  |  | +        <result property="totalSend"    column="total_send"    />
 | 
	
		
			
				|  |  | +        <result property="createTime"    column="create_time"    />
 | 
	
		
			
				|  |  | +        <result property="updateTime"    column="udpate_time"    />
 | 
	
		
			
				|  |  | +        <result property="createBy"    column="create_by"    />
 | 
	
		
			
				|  |  | +        <result property="updateBy"    column="update_by"    />
 | 
	
		
			
				|  |  | +    </resultMap>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <sql id="selectLiveLotteryProductConfVo">
 | 
	
		
			
				|  |  | +        select id, lottery_id, live_id, product_id, prize_level, per_lottery_num, total_lots, total_send, create_time, update_time, create_by, update_by from live_lottery_product_conf
 | 
	
		
			
				|  |  | +    </sql>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <select id="selectLiveLotteryProductConfList" parameterType="LiveLotteryProductConf" resultMap="LiveLotteryProductConfResult">
 | 
	
		
			
				|  |  | +        <include refid="selectLiveLotteryProductConfVo"/>
 | 
	
		
			
				|  |  | +        <where>
 | 
	
		
			
				|  |  | +            <if test="lotteryId != null "> and lottery_id = #{lotteryId}</if>
 | 
	
		
			
				|  |  | +            <if test="liveId != null "> and live_id = #{liveId}</if>
 | 
	
		
			
				|  |  | +            <if test="productId != null "> and product_id = #{productId}</if>
 | 
	
		
			
				|  |  | +            <if test="prizeLevel != null "> and prize_level = #{prizeLevel}</if>
 | 
	
		
			
				|  |  | +            <if test="perLotteryNum != null "> and per_lottery_num = #{perLotteryNum}</if>
 | 
	
		
			
				|  |  | +            <if test="totalLots != null "> and total_lots = #{totalLots}</if>
 | 
	
		
			
				|  |  | +            <if test="totalSend != null "> and total_send = #{totalSend}</if>
 | 
	
		
			
				|  |  | +            <if test="createTime != null "> and create_time = #{createTime}</if>
 | 
	
		
			
				|  |  | +        </where>
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <select id="selectLiveLotteryProductConfById" parameterType="Long" resultMap="LiveLotteryProductConfResult">
 | 
	
		
			
				|  |  | +        <include refid="selectLiveLotteryProductConfVo"/>
 | 
	
		
			
				|  |  | +        where id = #{id}
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <insert id="insertLiveLotteryProductConf" parameterType="LiveLotteryProductConf" useGeneratedKeys="true" keyProperty="id">
 | 
	
		
			
				|  |  | +        insert into live_lottery_product_conf
 | 
	
		
			
				|  |  | +        <trim prefix="(" suffix=")" suffixOverrides=",">
 | 
	
		
			
				|  |  | +            <if test="lotteryId != null">lottery_id,</if>
 | 
	
		
			
				|  |  | +            <if test="liveId != null">live_id,</if>
 | 
	
		
			
				|  |  | +            <if test="productId != null">product_id,</if>
 | 
	
		
			
				|  |  | +            <if test="prizeLevel != null">prize_level,</if>
 | 
	
		
			
				|  |  | +            <if test="perLotteryNum != null">per_lottery_num,</if>
 | 
	
		
			
				|  |  | +            <if test="totalLots != null">total_lots,</if>
 | 
	
		
			
				|  |  | +            <if test="totalSend != null">total_send,</if>
 | 
	
		
			
				|  |  | +            <if test="createTime != null">create_time,</if>
 | 
	
		
			
				|  |  | +            <if test="updateTime != null">udpate_time,</if>
 | 
	
		
			
				|  |  | +            <if test="createBy != null">create_by,</if>
 | 
	
		
			
				|  |  | +            <if test="updateBy != null">update_by,</if>
 | 
	
		
			
				|  |  | +         </trim>
 | 
	
		
			
				|  |  | +        <trim prefix="values (" suffix=")" suffixOverrides=",">
 | 
	
		
			
				|  |  | +            <if test="lotteryId != null">#{lotteryId},</if>
 | 
	
		
			
				|  |  | +            <if test="liveId != null">#{liveId},</if>
 | 
	
		
			
				|  |  | +            <if test="productId != null">#{productId},</if>
 | 
	
		
			
				|  |  | +            <if test="prizeLevel != null">#{prizeLevel},</if>
 | 
	
		
			
				|  |  | +            <if test="perLotteryNum != null">#{perLotteryNum},</if>
 | 
	
		
			
				|  |  | +            <if test="totalLots != null">#{totalLots},</if>
 | 
	
		
			
				|  |  | +            <if test="totalSend != null">#{totalSend},</if>
 | 
	
		
			
				|  |  | +            <if test="createTime != null">#{createTime},</if>
 | 
	
		
			
				|  |  | +            <if test="updateTime != null">#{updateTime},</if>
 | 
	
		
			
				|  |  | +            <if test="createBy != null">#{createBy},</if>
 | 
	
		
			
				|  |  | +            <if test="updateBy != null">#{updateBy},</if>
 | 
	
		
			
				|  |  | +         </trim>
 | 
	
		
			
				|  |  | +    </insert>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <update id="updateLiveLotteryProductConf" parameterType="LiveLotteryProductConf">
 | 
	
		
			
				|  |  | +        update live_lottery_product_conf
 | 
	
		
			
				|  |  | +        <trim prefix="SET" suffixOverrides=",">
 | 
	
		
			
				|  |  | +            <if test="lotteryId != null">lottery_id = #{lotteryId},</if>
 | 
	
		
			
				|  |  | +            <if test="liveId != null">live_id = #{liveId},</if>
 | 
	
		
			
				|  |  | +            <if test="productId != null">product_id = #{productId},</if>
 | 
	
		
			
				|  |  | +            <if test="prizeLevel != null">prize_level = #{prizeLevel},</if>
 | 
	
		
			
				|  |  | +            <if test="perLotteryNum != null">per_lottery_num = #{perLotteryNum},</if>
 | 
	
		
			
				|  |  | +            <if test="totalLots != null">total_lots = #{totalLots},</if>
 | 
	
		
			
				|  |  | +            <if test="totalSend != null">total_send = #{totalSend},</if>
 | 
	
		
			
				|  |  | +            <if test="createTime != null">create_time = #{createTime},</if>
 | 
	
		
			
				|  |  | +            <if test="updateTime != null">udpate_time = #{updateTime},</if>
 | 
	
		
			
				|  |  | +            <if test="createBy != null">create_by = #{createBy},</if>
 | 
	
		
			
				|  |  | +            <if test="updateBy != null">update_by = #{updateBy},</if>
 | 
	
		
			
				|  |  | +        </trim>
 | 
	
		
			
				|  |  | +        where id = #{id}
 | 
	
		
			
				|  |  | +    </update>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <delete id="deleteLiveLotteryProductConfByIds" parameterType="String">
 | 
	
		
			
				|  |  | +        delete from live_lottery_product_conf where id in
 | 
	
		
			
				|  |  | +        <foreach item="id" collection="array" open="(" separator="," close=")">
 | 
	
		
			
				|  |  | +            #{id}
 | 
	
		
			
				|  |  | +        </foreach>
 | 
	
		
			
				|  |  | +    </delete>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <insert id="saveProducts" parameterType="com.fs.live.param.LiveLotteryProductSaveParam">
 | 
	
		
			
				|  |  | +        insert into live_lottery_product_conf
 | 
	
		
			
				|  |  | +        (lottery_id,live_id,product_id,prize_level,per_lottery_num
 | 
	
		
			
				|  |  | +        ,total_lots,total_send,create_time,create_by)
 | 
	
		
			
				|  |  | +        values
 | 
	
		
			
				|  |  | +        <foreach item="liveLotteryProduct" collection="prizes" separator="," >
 | 
	
		
			
				|  |  | +            <trim prefix="(" suffix=")" suffixOverrides=",">
 | 
	
		
			
				|  |  | +                #{lotteryId},
 | 
	
		
			
				|  |  | +                #{liveId},
 | 
	
		
			
				|  |  | +                #{liveLotteryProduct.productId},
 | 
	
		
			
				|  |  | +                #{liveLotteryProduct.prizeLevel},
 | 
	
		
			
				|  |  | +                #{liveLotteryProduct.perLotteryNum},
 | 
	
		
			
				|  |  | +                #{liveLotteryProduct.totalLots},
 | 
	
		
			
				|  |  | +                #{liveLotteryProduct.totalSend},
 | 
	
		
			
				|  |  | +                #{createTime},
 | 
	
		
			
				|  |  | +                #{createBy},
 | 
	
		
			
				|  |  | +            </trim>
 | 
	
		
			
				|  |  | +        </foreach>
 | 
	
		
			
				|  |  | +    </insert>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <select id="selectLiveLotteryProductConfByLotteryId" parameterType="Long" resultType="com.fs.live.param.LiveLotteryProduct">
 | 
	
		
			
				|  |  | +        select product_id,prize_level,per_lottery_num,total_lots,total_send
 | 
	
		
			
				|  |  | +        from live_lottery_product_conf
 | 
	
		
			
				|  |  | +        where lottery_id = #{lotteryId}
 | 
	
		
			
				|  |  | +        order by prize_level
 | 
	
		
			
				|  |  | +    </select>
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    <delete id="deleteLiveLotteryProductConfByLotteryId" parameterType="Long" >
 | 
	
		
			
				|  |  | +        delete from live_lottery_product_conf where lottery_id = #{lotteryId}
 | 
	
		
			
				|  |  | +    </delete>
 | 
	
		
			
				|  |  | +</mapper>
 |