<?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.ibs.list.mapper.OtherBankRateMapper">
    
    <resultMap type="OtherBankRate" id="OtherBankRateResult">
        <result property="id"    column="id"    />
        <result property="custIdc"    column="cust_idc"    />
        <result property="bank"    column="bank"    />
        <result property="rate"    column="rate"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="source"    column="source"    />
    </resultMap>

    <sql id="selectOtherBankRateVo">
        select id, cust_idc, bank, rate, create_by, create_time, update_by, update_time,source from other_bank_rate
    </sql>

    <select id="selectOtherBankRateList" parameterType="OtherBankRate" resultMap="OtherBankRateResult">
        <include refid="selectOtherBankRateVo"/>
        <where>  
            <if test="custIdc != null  and custIdc != ''"> and cust_idc = #{custIdc}</if>
            <if test="bank != null  and bank != ''"> and bank = #{bank}</if>
            <if test="rate != null  and rate != ''"> and rate = #{rate}</if>
            <if test="source != null  and source != ''"> and source = #{source}</if>
        </where>
    </select>
    
    <select id="selectOtherBankRateById" parameterType="Long" resultMap="OtherBankRateResult">
        <include refid="selectOtherBankRateVo"/>
        where id = #{id}
    </select>

    <insert id="insertOtherBankRate" parameterType="OtherBankRate" useGeneratedKeys="true" keyProperty="id">
        insert into other_bank_rate
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="custIdc != null">cust_idc,</if>
            <if test="bank != null">bank,</if>
            <if test="rate != null">rate,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="source != null">source,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="custIdc != null">#{custIdc},</if>
            <if test="bank != null">#{bank},</if>
            <if test="rate != null">#{rate},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="source != null">#{source},</if>
         </trim>
    </insert>

    <update id="updateOtherBankRate" parameterType="OtherBankRate">
        update other_bank_rate
        <trim prefix="SET" suffixOverrides=",">
            <if test="custIdc != null">cust_idc = #{custIdc},</if>
            <if test="bank != null">bank = #{bank},</if>
            <if test="rate != null">rate = #{rate},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="source != null">source = #{source},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteOtherBankRateById" parameterType="Long">
        delete from other_bank_rate where id = #{id}
    </delete>

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