<?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.PlayletUserWithdrawalPasswordMapper">

    <resultMap type="PlayletUserWithdrawalPassword" id="PlayletUserWithdrawalPasswordResult">
        <result property="id"    column="id"    />
        <result property="userId"    column="user_id"    />
        <result property="password"    column="password"    />
        <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="selectPlayletUserWithdrawalPasswordVo">
        select id, user_id, password, create_by, update_by, create_time, update_time, remark from playlet_user_withdrawal_password
    </sql>

    <select id="selectPlayletUserWithdrawalPasswordList" parameterType="PlayletUserWithdrawalPassword" resultMap="PlayletUserWithdrawalPasswordResult">
        <include refid="selectPlayletUserWithdrawalPasswordVo"/>
        <where>
            <if test="userId != null  and userId != ''"> and user_id = #{userId}</if>
            <if test="password != null  and password != ''"> and password = #{password}</if>
        </where>
    </select>

    <select id="selectPlayletUserWithdrawalPasswordById" parameterType="Long" resultMap="PlayletUserWithdrawalPasswordResult">
        <include refid="selectPlayletUserWithdrawalPasswordVo"/>
        where id = #{id}
    </select>

    <insert id="insertPlayletUserWithdrawalPassword" parameterType="PlayletUserWithdrawalPassword" useGeneratedKeys="true" keyProperty="id">
        insert into playlet_user_withdrawal_password
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="userId != null and userId != ''">user_id,</if>
            <if test="password != null and password != ''">password,</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 and remark != ''">remark,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="userId != null and userId != ''">#{userId},</if>
            <if test="password != null and password != ''">#{password},</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 and remark != ''">#{remark},</if>
        </trim>
    </insert>

    <update id="updatePlayletUserWithdrawalPassword" parameterType="PlayletUserWithdrawalPassword">
        update playlet_user_withdrawal_password
        <trim prefix="SET" suffixOverrides=",">
            <if test="userId != null and userId != ''">user_id = #{userId},</if>
            <if test="password != null and password != ''">password = #{password},</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 and remark != ''">remark = #{remark},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deletePlayletUserWithdrawalPasswordById" parameterType="Long">
        delete from playlet_user_withdrawal_password where id = #{id}
    </delete>

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

</mapper>