<?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.game.business.mapper.AppUserLiveDividedRecordMapper">
    
    <resultMap type="com.game.business.domain.AppUserLiveDividedRecord" id="AppUserLiveDividedRecordResult">
        <result property="id"    column="id"    />
        <result property="userId"    column="user_id"    />
        <result property="rate"    column="rate"    />
        <result property="userLiveDividedId"    column="user_live_divided_id"    />
        <result property="money"    column="money"    />
        <result property="currencyType"    column="currency_type"    />
        <result property="createTime"    column="create_time"    />
    </resultMap>

    <sql id="selectAppUserLiveDividedRecordVo">
        select id, user_id, rate, user_live_divided_id, money, currency_type, create_time from app_user_live_divided_record
    </sql>

    <select id="selectAppUserLiveDividedRecordList" parameterType="com.game.business.domain.AppUserLiveDividedRecord" resultMap="AppUserLiveDividedRecordResult">
        <include refid="selectAppUserLiveDividedRecordVo"/>
        <where>  
            <if test="userId != null "> and user_id = #{userId}</if>
            <if test="rate != null "> and rate = #{rate}</if>
            <if test="userLiveDividedId != null "> and user_live_divided_id = #{userLiveDividedId}</if>
            <if test="money != null "> and money = #{money}</if>
            <if test="currencyType != null "> and currency_type = #{currencyType}</if>
        </where>
    </select>
    
    <select id="selectAppUserLiveDividedRecordById" parameterType="Long" resultMap="AppUserLiveDividedRecordResult">
        <include refid="selectAppUserLiveDividedRecordVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertAppUserLiveDividedRecord" parameterType="com.game.business.domain.AppUserLiveDividedRecord" useGeneratedKeys="true" keyProperty="id">
        insert into app_user_live_divided_record
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="userId != null">user_id,</if>
            <if test="rate != null">rate,</if>
            <if test="userLiveDividedId != null">user_live_divided_id,</if>
            <if test="money != null">money,</if>
            <if test="currencyType != null">currency_type,</if>
            <if test="createTime != null">create_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="userId != null">#{userId},</if>
            <if test="rate != null">#{rate},</if>
            <if test="userLiveDividedId != null">#{userLiveDividedId},</if>
            <if test="money != null">#{money},</if>
            <if test="currencyType != null">#{currencyType},</if>
            <if test="createTime != null">#{createTime},</if>
         </trim>
    </insert>

    <update id="updateAppUserLiveDividedRecord" parameterType="com.game.business.domain.AppUserLiveDividedRecord">
        update app_user_live_divided_record
        <trim prefix="SET" suffixOverrides=",">
            <if test="userId != null">user_id = #{userId},</if>
            <if test="rate != null">rate = #{rate},</if>
            <if test="userLiveDividedId != null">user_live_divided_id = #{userLiveDividedId},</if>
            <if test="money != null">money = #{money},</if>
            <if test="currencyType != null">currency_type = #{currencyType},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteAppUserLiveDividedRecordById" parameterType="Long">
        delete from app_user_live_divided_record where id = #{id}
    </delete>

    <delete id="deleteAppUserLiveDividedRecordByIds" parameterType="String">
        delete from app_user_live_divided_record where id in 
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>