<?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.ruoyi.model.mapper.WithdrawalConfigMapper">
    
    <resultMap type="WithdrawalConfig" id="WithdrawalConfigResult">
        <result property="id"    column="id"    />
        <result property="withdrawalTitle"    column="withdrawal_title"    />
        <result property="withdrawalText"    column="withdrawal_text"    />
        <result property="withdrawalMessage"    column="withdrawal_message"    />
    </resultMap>

    <sql id="selectWithdrawalConfigVo">
        select id, withdrawal_title, withdrawal_text, withdrawal_message from withdrawal_config
    </sql>

    <select id="selectWithdrawalConfigList" parameterType="WithdrawalConfig" resultMap="WithdrawalConfigResult">
        <include refid="selectWithdrawalConfigVo"/>
        <where>  
            <if test="withdrawalTitle != null  and withdrawalTitle != ''"> and withdrawal_title = #{withdrawalTitle}</if>
            <if test="withdrawalText != null  and withdrawalText != ''"> and withdrawal_text = #{withdrawalText}</if>
            <if test="withdrawalMessage != null  and withdrawalMessage != ''"> and withdrawal_message = #{withdrawalMessage}</if>
        </where>
    </select>
    
    <select id="selectWithdrawalConfigById" parameterType="Long" resultMap="WithdrawalConfigResult">
        <include refid="selectWithdrawalConfigVo"/>
        where id = #{id}
    </select>
    <select id="getWithdrawalConfigList" resultType="com.ruoyi.model.domain.WithdrawalConfig">
        <include refid="selectWithdrawalConfigVo"/>
    </select>

    <insert id="insertWithdrawalConfig" parameterType="WithdrawalConfig">
        insert into withdrawal_config
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="withdrawalTitle != null">withdrawal_title,</if>
            <if test="withdrawalText != null">withdrawal_text,</if>
            <if test="withdrawalMessage != null">withdrawal_message,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="withdrawalTitle != null">#{withdrawalTitle},</if>
            <if test="withdrawalText != null">#{withdrawalText},</if>
            <if test="withdrawalMessage != null">#{withdrawalMessage},</if>
         </trim>
    </insert>

    <update id="updateWithdrawalConfig" parameterType="WithdrawalConfig">
        update withdrawal_config
        <trim prefix="SET" suffixOverrides=",">
            <if test="withdrawalTitle != null">withdrawal_title = #{withdrawalTitle},</if>
            <if test="withdrawalText != null">withdrawal_text = #{withdrawalText},</if>
            <if test="withdrawalMessage != null">withdrawal_message = #{withdrawalMessage},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteWithdrawalConfigById" parameterType="Long">
        delete from withdrawal_config where id = #{id}
    </delete>

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