<?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.AppUserLiveDividedMapper">
    
    <resultMap type="com.game.business.domain.AppUserLiveDivided" id="AppUserLiveDividedResult">
        <result property="id"    column="id"    />
        <result property="userId"    column="user_id"    />
        <result property="money"    column="money"    />
        <result property="currencyType"    column="currency_type"    />
        <result property="otherId"    column="other_id"    />
        <result property="status"    column="status"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
    </resultMap>

    <sql id="selectAppUserLiveDividedVo">
        select id, user_id, money, currency_type, other_id, status, create_time, update_time from app_user_live_divided
    </sql>

    <select id="selectAppUserLiveDividedList" parameterType="com.game.business.domain.AppUserLiveDivided" resultMap="AppUserLiveDividedResult">
        <include refid="selectAppUserLiveDividedVo"/>
        <where>  
            <if test="userId != null "> and user_id = #{userId}</if>
            <if test="money != null "> and money = #{money}</if>
            <if test="currencyType != null "> and currency_type = #{currencyType}</if>
            <if test="otherId != null "> and other_id = #{otherId}</if>
            <if test="status != null "> and status = #{status}</if>
        </where>
    </select>
    
    <select id="selectAppUserLiveDividedById" parameterType="Long" resultMap="AppUserLiveDividedResult">
        <include refid="selectAppUserLiveDividedVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertAppUserLiveDivided" parameterType="com.game.business.domain.AppUserLiveDivided">
        insert into app_user_live_divided
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="userId != null">user_id,</if>
            <if test="money != null">money,</if>
            <if test="currencyType != null">currency_type,</if>
            <if test="otherId != null">other_id,</if>
            <if test="status != null">status,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="userId != null">#{userId},</if>
            <if test="money != null">#{money},</if>
            <if test="currencyType != null">#{currencyType},</if>
            <if test="otherId != null">#{otherId},</if>
            <if test="status != null">#{status},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
         </trim>
    </insert>

    <update id="updateAppUserLiveDivided" parameterType="com.game.business.domain.AppUserLiveDivided">
        update app_user_live_divided
        <trim prefix="SET" suffixOverrides=",">
            <if test="userId != null">user_id = #{userId},</if>
            <if test="money != null">money = #{money},</if>
            <if test="currencyType != null">currency_type = #{currencyType},</if>
            <if test="otherId != null">other_id = #{otherId},</if>
            <if test="status != null">status = #{status},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteAppUserLiveDividedById" parameterType="Long">
        delete from app_user_live_divided where id = #{id}
    </delete>

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