<?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.playlet.system.mapper.PlayletUserWithdrawDepositRecordMapper">

    <resultMap type="PlayletUserWithdrawDepositRecord" id="PlayletUserWithdrawDepositRecordResult">
        <result property="id"    column="id"    />
        <result property="userId"    column="user_id"    />
        <result property="withdrawOrder"    column="withdraw_order"    />
        <result property="accountingTime"    column="accounting_time"    />
        <result property="withdrawBankId"    column="withdraw_bank_id"    />
        <result property="withdrawBank"    column="withdraw_bank"    />
        <result property="withdrawOpeningBank"    column="withdraw_opening_bank"    />
        <result property="status"    column="status"    />
        <result property="withdrawApplyTime"    column="withdraw_apply_time"    />
        <result property="withdrawApplyTotal"    column="withdraw_apply_total"    />
        <result property="withdrawRealityTotal"    column="withdraw_reality_total"    />
        <result property="withdrawCharge"    column="withdraw_charge"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateBy"    column="update_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
    </resultMap>

    <sql id="selectPlayletUserWithdrawDepositRecordVo">
        select id, user_id, withdraw_order, accounting_time, withdraw_bank_id, withdraw_bank, withdraw_opening_bank, status, withdraw_apply_time, withdraw_apply_total, withdraw_reality_total, withdraw_charge, create_by, update_by, create_time, update_time, remark from playlet_user_withdraw_deposit_record
    </sql>

    <select id="selectPlayletUserWithdrawDepositRecordList" parameterType="PlayletUserWithdrawDepositRecord" resultMap="PlayletUserWithdrawDepositRecordResult">
        <include refid="selectPlayletUserWithdrawDepositRecordVo"/>
        <where>
            <if test="userId != null  and userId != ''"> and user_id = #{userId}</if>
            <if test="withdrawOrder != null  and withdrawOrder != ''"> and withdraw_order = #{withdrawOrder}</if>
            <if test="accountingTime != null "> and accounting_time = #{accountingTime}</if>
            <if test="withdrawBankId != null  and withdrawBankId != ''"> and withdraw_bank_id = #{withdrawBankId}</if>
            <if test="withdrawBank != null  and withdrawBank != ''"> and withdraw_bank = #{withdrawBank}</if>
            <if test="withdrawOpeningBank != null  and withdrawOpeningBank != ''"> and withdraw_opening_bank = #{withdrawOpeningBank}</if>
            <if test="status != null "> and status = #{status}</if>
            <if test="withdrawApplyTime != null "> and withdraw_apply_time = #{withdrawApplyTime}</if>
            <if test="withdrawApplyTotal != null "> and withdraw_apply_total = #{withdrawApplyTotal}</if>
            <if test="withdrawRealityTotal != null "> and withdraw_reality_total = #{withdrawRealityTotal}</if>
            <if test="withdrawCharge != null "> and withdraw_charge = #{withdrawCharge}</if>
        </where>
    </select>

    <select id="selectPlayletUserWithdrawDepositRecordById" parameterType="Long" resultMap="PlayletUserWithdrawDepositRecordResult">
        <include refid="selectPlayletUserWithdrawDepositRecordVo"/>
        where id = #{id}
    </select>

    <insert id="insertPlayletUserWithdrawDepositRecord" parameterType="PlayletUserWithdrawDepositRecord" useGeneratedKeys="true" keyProperty="id">
        insert into playlet_user_withdraw_deposit_record
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="userId != null and userId != ''">user_id,</if>
            <if test="withdrawOrder != null and withdrawOrder != ''">withdraw_order,</if>
            <if test="accountingTime != null">accounting_time,</if>
            <if test="withdrawBankId != null and withdrawBankId != ''">withdraw_bank_id,</if>
            <if test="withdrawBank != null and withdrawBank != ''">withdraw_bank,</if>
            <if test="withdrawOpeningBank != null and withdrawOpeningBank != ''">withdraw_opening_bank,</if>
            <if test="status != null">status,</if>
            <if test="withdrawApplyTime != null">withdraw_apply_time,</if>
            <if test="withdrawApplyTotal != null">withdraw_apply_total,</if>
            <if test="withdrawRealityTotal != null">withdraw_reality_total,</if>
            <if test="withdrawCharge != null">withdraw_charge,</if>
            <if test="createBy != null and createBy != ''">create_by,</if>
            <if test="updateBy != null and updateBy != ''">update_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="userId != null and userId != ''">#{userId},</if>
            <if test="withdrawOrder != null and withdrawOrder != ''">#{withdrawOrder},</if>
            <if test="accountingTime != null">#{accountingTime},</if>
            <if test="withdrawBankId != null and withdrawBankId != ''">#{withdrawBankId},</if>
            <if test="withdrawBank != null and withdrawBank != ''">#{withdrawBank},</if>
            <if test="withdrawOpeningBank != null and withdrawOpeningBank != ''">#{withdrawOpeningBank},</if>
            <if test="status != null">#{status},</if>
            <if test="withdrawApplyTime != null">#{withdrawApplyTime},</if>
            <if test="withdrawApplyTotal != null">#{withdrawApplyTotal},</if>
            <if test="withdrawRealityTotal != null">#{withdrawRealityTotal},</if>
            <if test="withdrawCharge != null">#{withdrawCharge},</if>
            <if test="createBy != null and createBy != ''">#{createBy},</if>
            <if test="updateBy != null and updateBy != ''">#{updateBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
        </trim>
    </insert>

    <update id="updatePlayletUserWithdrawDepositRecord" parameterType="PlayletUserWithdrawDepositRecord">
        update playlet_user_withdraw_deposit_record
        <trim prefix="SET" suffixOverrides=",">
            <if test="userId != null and userId != ''">user_id = #{userId},</if>
            <if test="withdrawOrder != null and withdrawOrder != ''">withdraw_order = #{withdrawOrder},</if>
            <if test="accountingTime != null">accounting_time = #{accountingTime},</if>
            <if test="withdrawBankId != null and withdrawBankId != ''">withdraw_bank_id = #{withdrawBankId},</if>
            <if test="withdrawBank != null and withdrawBank != ''">withdraw_bank = #{withdrawBank},</if>
            <if test="withdrawOpeningBank != null and withdrawOpeningBank != ''">withdraw_opening_bank = #{withdrawOpeningBank},</if>
            <if test="status != null">status = #{status},</if>
            <if test="withdrawApplyTime != null">withdraw_apply_time = #{withdrawApplyTime},</if>
            <if test="withdrawApplyTotal != null">withdraw_apply_total = #{withdrawApplyTotal},</if>
            <if test="withdrawRealityTotal != null">withdraw_reality_total = #{withdrawRealityTotal},</if>
            <if test="withdrawCharge != null">withdraw_charge = #{withdrawCharge},</if>
            <if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
            <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deletePlayletUserWithdrawDepositRecordById" parameterType="Long">
        delete from playlet_user_withdraw_deposit_record where id = #{id}
    </delete>

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

</mapper>