<?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.frequency.pfwithdrawalway.mapper.PfWithdrawalWayMapper">
    
    <resultMap type="com.ruoyi.frequency.pfwithdrawalway.entity.PfWithdrawalWay" id="PfWithdrawalWayResult">
        <result property="id"    column="id"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="name"    column="name"    />
        <result property="logo"    column="logo"    />
        <result property="isBank"    column="is_bank"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="sort"    column="sort"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateBy"    column="update_by"    />
    </resultMap>

    <sql id="selectPfWithdrawalWayVo">
        select id, create_time, update_time, name, logo, is_bank, del_flag, sort, create_by, update_by from t_pf_withdrawal_way
    </sql>

    <select id="selectPfWithdrawalWayList" parameterType="com.ruoyi.frequency.pfwithdrawalway.entity.PfWithdrawalWay" resultMap="PfWithdrawalWayResult">
        <include refid="selectPfWithdrawalWayVo"/>
        <where>  
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
            <if test="logo != null  and logo != ''"> and logo = #{logo}</if>
            <if test="isBank != null "> and is_bank = #{isBank}</if>
            <if test="sort != null "> and sort = #{sort}</if>
            <if test="createBy != null "> and create_by = #{createBy}</if>
            <if test="updateBy != null "> and update_by = #{updateBy}</if>
        </where>
    </select>
    
    <select id="selectPfWithdrawalWayById" parameterType="Long" resultMap="PfWithdrawalWayResult">
        <include refid="selectPfWithdrawalWayVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertPfWithdrawalWay" parameterType="com.ruoyi.frequency.pfwithdrawalway.entity.PfWithdrawalWay">
        insert into t_pf_withdrawal_way
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="name != null and name != ''">name,</if>
            <if test="logo != null">logo,</if>
            <if test="isBank != null">is_bank,</if>
            <if test="delFlag != null">del_flag,</if>
            <if test="sort != null">sort,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateBy != null">update_by,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="name != null and name != ''">#{name},</if>
            <if test="logo != null">#{logo},</if>
            <if test="isBank != null">#{isBank},</if>
            <if test="delFlag != null">#{delFlag},</if>
            <if test="sort != null">#{sort},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateBy != null">#{updateBy},</if>
         </trim>
    </insert>

    <update id="updatePfWithdrawalWay" parameterType="com.ruoyi.frequency.pfwithdrawalway.entity.PfWithdrawalWay">
        update t_pf_withdrawal_way
        <trim prefix="SET" suffixOverrides=",">
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="name != null and name != ''">name = #{name},</if>
            <if test="logo != null">logo = #{logo},</if>
            <if test="isBank != null">is_bank = #{isBank},</if>
            <if test="delFlag != null">del_flag = #{delFlag},</if>
            <if test="sort != null">sort = #{sort},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deletePfWithdrawalWayById" parameterType="Long">
        delete from t_pf_withdrawal_way where id = #{id}
    </delete>

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