<?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.SignedProductsMapper">
    
    <resultMap type="SignedProducts" id="SignedProductsResult">
        <result property="currdeposFlag"    column="currdepos_flag"    />
        <result property="hatflowcostbookFlag"    column="hatflowcostbook_flag"    />
        <result property="phmortgloanFlag"    column="phmortgloan_flag"    />
        <result property="zheliloanFlag"    column="zheliloan_flag"    />
        <result property="frcdFlag"    column="frcd_flag"    />
        <result property="financialbookFlag"    column="financialbook_flag"    />
        <result property="fundbookFlag"    column="fundbook_flag"    />
        <result property="insurbookFlag"    column="insurbook_flag"    />
        <result property="bondbookFlag"    column="bondbook_flag"    />
        <result property="watfeeWhcFlag"    column="watfee_whc_flag"    />
        <result property="elefeeWhcFlag"    column="elefee_whc_flag"    />
        <result property="gasfeeWhcFlag"    column="gasfee_whc_flag"    />
        <result property="etcFlag"    column="etc_flag"    />
        <result property="custId"    column="cust_id"    />
    </resultMap>

    <sql id="selectSignedProductsVo">
        select currdepos_flag, hatflowcostbook_flag, phmortgloan_flag, zheliloan_flag, frcd_flag, financialbook_flag, fundbook_flag, insurbook_flag, bondbook_flag, watfee_whc_flag, elefee_whc_flag, gasfee_whc_flag, etc_flag, cust_id from signed_products
    </sql>

    <select id="selectSignedProductsList" parameterType="SignedProducts" resultMap="SignedProductsResult">
        <include refid="selectSignedProductsVo"/>
        <where>  
            <if test="currdeposFlag != null  and currdeposFlag != ''"> and currdepos_flag = #{currdeposFlag}</if>
            <if test="hatflowcostbookFlag != null  and hatflowcostbookFlag != ''"> and hatflowcostbook_flag = #{hatflowcostbookFlag}</if>
            <if test="phmortgloanFlag != null  and phmortgloanFlag != ''"> and phmortgloan_flag = #{phmortgloanFlag}</if>
            <if test="zheliloanFlag != null  and zheliloanFlag != ''"> and zheliloan_flag = #{zheliloanFlag}</if>
            <if test="frcdFlag != null  and frcdFlag != ''"> and frcd_flag = #{frcdFlag}</if>
            <if test="financialbookFlag != null  and financialbookFlag != ''"> and financialbook_flag = #{financialbookFlag}</if>
            <if test="fundbookFlag != null  and fundbookFlag != ''"> and fundbook_flag = #{fundbookFlag}</if>
            <if test="insurbookFlag != null  and insurbookFlag != ''"> and insurbook_flag = #{insurbookFlag}</if>
            <if test="bondbookFlag != null  and bondbookFlag != ''"> and bondbook_flag = #{bondbookFlag}</if>
            <if test="watfeeWhcFlag != null  and watfeeWhcFlag != ''"> and watfee_whc_flag = #{watfeeWhcFlag}</if>
            <if test="elefeeWhcFlag != null  and elefeeWhcFlag != ''"> and elefee_whc_flag = #{elefeeWhcFlag}</if>
            <if test="gasfeeWhcFlag != null  and gasfeeWhcFlag != ''"> and gasfee_whc_flag = #{gasfeeWhcFlag}</if>
            <if test="etcFlag != null  and etcFlag != ''"> and etc_flag = #{etcFlag}</if>
            <if test="custId != null  and custId != ''"> and cust_id = #{custId}</if>
        </where>
    </select>
    
    <select id="selectSignedProductsByCurrdeposFlag" parameterType="String" resultMap="SignedProductsResult">
        <include refid="selectSignedProductsVo"/>
        where cust_id = #{custId}
    </select>

    <insert id="insertSignedProducts" parameterType="SignedProducts">
        insert into signed_products
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="currdeposFlag != null">currdepos_flag,</if>
            <if test="hatflowcostbookFlag != null">hatflowcostbook_flag,</if>
            <if test="phmortgloanFlag != null">phmortgloan_flag,</if>
            <if test="zheliloanFlag != null">zheliloan_flag,</if>
            <if test="frcdFlag != null">frcd_flag,</if>
            <if test="financialbookFlag != null">financialbook_flag,</if>
            <if test="fundbookFlag != null">fundbook_flag,</if>
            <if test="insurbookFlag != null">insurbook_flag,</if>
            <if test="bondbookFlag != null">bondbook_flag,</if>
            <if test="watfeeWhcFlag != null">watfee_whc_flag,</if>
            <if test="elefeeWhcFlag != null">elefee_whc_flag,</if>
            <if test="gasfeeWhcFlag != null">gasfee_whc_flag,</if>
            <if test="etcFlag != null">etc_flag,</if>
            <if test="custId != null">cust_id,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="currdeposFlag != null">#{currdeposFlag},</if>
            <if test="hatflowcostbookFlag != null">#{hatflowcostbookFlag},</if>
            <if test="phmortgloanFlag != null">#{phmortgloanFlag},</if>
            <if test="zheliloanFlag != null">#{zheliloanFlag},</if>
            <if test="frcdFlag != null">#{frcdFlag},</if>
            <if test="financialbookFlag != null">#{financialbookFlag},</if>
            <if test="fundbookFlag != null">#{fundbookFlag},</if>
            <if test="insurbookFlag != null">#{insurbookFlag},</if>
            <if test="bondbookFlag != null">#{bondbookFlag},</if>
            <if test="watfeeWhcFlag != null">#{watfeeWhcFlag},</if>
            <if test="elefeeWhcFlag != null">#{elefeeWhcFlag},</if>
            <if test="gasfeeWhcFlag != null">#{gasfeeWhcFlag},</if>
            <if test="etcFlag != null">#{etcFlag},</if>
            <if test="custId != null">#{custId},</if>
         </trim>
    </insert>

    <update id="updateSignedProducts" parameterType="SignedProducts">
        update signed_products
        <trim prefix="SET" suffixOverrides=",">
            <if test="hatflowcostbookFlag != null">hatflowcostbook_flag = #{hatflowcostbookFlag},</if>
            <if test="phmortgloanFlag != null">phmortgloan_flag = #{phmortgloanFlag},</if>
            <if test="zheliloanFlag != null">zheliloan_flag = #{zheliloanFlag},</if>
            <if test="frcdFlag != null">frcd_flag = #{frcdFlag},</if>
            <if test="financialbookFlag != null">financialbook_flag = #{financialbookFlag},</if>
            <if test="fundbookFlag != null">fundbook_flag = #{fundbookFlag},</if>
            <if test="insurbookFlag != null">insurbook_flag = #{insurbookFlag},</if>
            <if test="bondbookFlag != null">bondbook_flag = #{bondbookFlag},</if>
            <if test="watfeeWhcFlag != null">watfee_whc_flag = #{watfeeWhcFlag},</if>
            <if test="elefeeWhcFlag != null">elefee_whc_flag = #{elefeeWhcFlag},</if>
            <if test="gasfeeWhcFlag != null">gasfee_whc_flag = #{gasfeeWhcFlag},</if>
            <if test="etcFlag != null">etc_flag = #{etcFlag},</if>
            <if test="custId != null">cust_id = #{custId},</if>
        </trim>
        where currdepos_flag = #{currdeposFlag}
    </update>

    <delete id="deleteSignedProductsByCurrdeposFlag" parameterType="String">
        delete from signed_products where currdepos_flag = #{currdeposFlag}
    </delete>

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