<?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.brilliance.isc.mda.dao.TfcMapper">

    <resultMap id="BaseResultMap" type="com.brilliance.isc.common.rmbbop.entity.Tfc">
        <result property="inr" column="inr" jdbcType="VARCHAR"/>
        <result property="ver" column="ver" jdbcType="VARCHAR"/>
        <result property="objtyp" column="objtyp" jdbcType="VARCHAR"/>
        <result property="objinr" column="objinr" jdbcType="VARCHAR"/>
        <result property="sta" column="sta" jdbcType="VARCHAR"/>
        <result property="listopertype" column="listopertype" jdbcType="VARCHAR"/>
        <result property="csta" column="csta" jdbcType="VARCHAR"/>
        <result property="seqno" column="seqno" jdbcType="INTEGER"/>
        <result property="buycurrencycode" column="buycurrencycode" jdbcType="VARCHAR"/>
        <result property="buyamt" column="buyamt" jdbcType="DECIMAL"/>
        <result property="price" column="price" jdbcType="DECIMAL"/>
        <result property="sellcurrencycode" column="sellcurrencycode" jdbcType="VARCHAR"/>
        <result property="sellamt" column="sellamt" jdbcType="DECIMAL"/>
        <result property="tradedate" column="tradedate" jdbcType="DATE"/>
        <result property="settledate" column="settledate" jdbcType="DATE"/>
    </resultMap>

    <sql id="Base_Column_List">
        inr,ver,objtyp,objinr,sta,listopertype,csta,seqno,buycurrencycode,buyamt,price,sellcurrencycode,sellamt,tradedate,settledate
    </sql>

    <select id="selectByPrimaryKey" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from tfc
        where inr = #{inr,jdbcType=VARCHAR}
    </select>

    <delete id="deleteByPrimaryKey">
        delete from tfc
        where inr = #{inr,jdbcType=VARCHAR}
    </delete>

    <insert id="insert">
        insert into tfc (<include refid="Base_Column_List" />)
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            #{inr,jdbcType=VARCHAR},
            #{ver,jdbcType=VARCHAR},
            #{objtyp,jdbcType=VARCHAR},
            #{objinr,jdbcType=VARCHAR},
            #{sta,jdbcType=VARCHAR},
            #{listopertype,jdbcType=VARCHAR},
            #{csta,jdbcType=VARCHAR},
            #{seqno,jdbcType=INTEGER},
            #{buycurrencycode,jdbcType=VARCHAR},
            #{buyamt,jdbcType=DECIMAL},
            #{price,jdbcType=DECIMAL},
            #{sellcurrencycode,jdbcType=VARCHAR},
            #{sellamt,jdbcType=DECIMAL},
            #{tradedate,jdbcType=DATE},
            #{settledate,jdbcType=DATE},
        </trim>
    </insert>

    <insert id="insertSelective">
        insert into tfc
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="inr != null">inr,</if>
            <if test="ver != null">ver,</if>
            <if test="objtyp != null">objtyp,</if>
            <if test="objinr != null">objinr,</if>
            <if test="sta != null">sta,</if>
            <if test="listopertype != null">listopertype,</if>
            <if test="csta != null">csta,</if>
            <if test="seqno != null">seqno,</if>
            <if test="buycurrencycode != null">buycurrencycode,</if>
            <if test="buyamt != null">buyamt,</if>
            <if test="price != null">price,</if>
            <if test="sellcurrencycode != null">sellcurrencycode,</if>
            <if test="sellamt != null">sellamt,</if>
            <if test="tradedate != null">tradedate,</if>
            <if test="settledate != null">settledate,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="inr != null">#{inr,jdbcType=VARCHAR}, </if>
            <if test="ver != null">#{ver,jdbcType=VARCHAR}, </if>
            <if test="objtyp != null">#{objtyp,jdbcType=VARCHAR}, </if>
            <if test="objinr != null">#{objinr,jdbcType=VARCHAR}, </if>
            <if test="sta != null">#{sta,jdbcType=VARCHAR}, </if>
            <if test="listopertype != null">#{listopertype,jdbcType=VARCHAR}, </if>
            <if test="csta != null">#{csta,jdbcType=VARCHAR}, </if>
            <if test="seqno != null">#{seqno,jdbcType=INTEGER}, </if>
            <if test="buycurrencycode != null">#{buycurrencycode,jdbcType=VARCHAR}, </if>
            <if test="buyamt != null">#{buyamt,jdbcType=DECIMAL}, </if>
            <if test="price != null">#{price,jdbcType=DECIMAL}, </if>
            <if test="sellcurrencycode != null">#{sellcurrencycode,jdbcType=VARCHAR}, </if>
            <if test="sellamt != null">#{sellamt,jdbcType=DECIMAL}, </if>
            <if test="tradedate != null">#{tradedate,jdbcType=DATE}, </if>
            <if test="settledate != null">#{settledate,jdbcType=DATE}, </if>
        </trim>
    </insert>

    <update id="updateByPrimaryKeySelective">
        update tfc
        <set>
            <if test="ver != null">ver = #{ver,jdbcType=VARCHAR},</if>
            <if test="objtyp != null">objtyp = #{objtyp,jdbcType=VARCHAR},</if>
            <if test="objinr != null">objinr = #{objinr,jdbcType=VARCHAR},</if>
            <if test="sta != null">sta = #{sta,jdbcType=VARCHAR},</if>
            <if test="listopertype != null">listopertype = #{listopertype,jdbcType=VARCHAR},</if>
            <if test="csta != null">csta = #{csta,jdbcType=VARCHAR},</if>
            <if test="seqno != null">seqno = #{seqno,jdbcType=INTEGER},</if>
            <if test="buycurrencycode != null">buycurrencycode = #{buycurrencycode,jdbcType=VARCHAR},</if>
            <if test="buyamt != null">buyamt = #{buyamt,jdbcType=DECIMAL},</if>
            <if test="price != null">price = #{price,jdbcType=DECIMAL},</if>
            <if test="sellcurrencycode != null">sellcurrencycode = #{sellcurrencycode,jdbcType=VARCHAR},</if>
            <if test="sellamt != null">sellamt = #{sellamt,jdbcType=DECIMAL},</if>
            <if test="tradedate != null">tradedate = #{tradedate,jdbcType=DATE},</if>
            <if test="settledate != null">settledate = #{settledate,jdbcType=DATE},</if>
        </set>
        where inr = #{inr,jdbcType=VARCHAR}
    </update>

    <update id="updateByPrimaryKey">
        update tfc
        <set>
            ver = #{ver,jdbcType=VARCHAR},
            objtyp = #{objtyp,jdbcType=VARCHAR},
            objinr = #{objinr,jdbcType=VARCHAR},
            sta = #{sta,jdbcType=VARCHAR},
            listopertype = #{listopertype,jdbcType=VARCHAR},
            csta = #{csta,jdbcType=VARCHAR},
            seqno = #{seqno,jdbcType=INTEGER},
            buycurrencycode = #{buycurrencycode,jdbcType=VARCHAR},
            buyamt = #{buyamt,jdbcType=DECIMAL},
            price = #{price,jdbcType=DECIMAL},
            sellcurrencycode = #{sellcurrencycode,jdbcType=VARCHAR},
            sellamt = #{sellamt,jdbcType=DECIMAL},
            tradedate = #{tradedate,jdbcType=DATE},
            settledate = #{settledate,jdbcType=DATE},
        </set>
        where inr = #{inr,jdbcType=VARCHAR}
    </update>

    <delete id="deleteByIds">
        delete from act where inr in
        <foreach item="item" index="index" collection="collection" open="(" separator="," close=")">
            #{item}
        </foreach>
    </delete>

    <update id="dyncUpdate">
        update tfc
        <set>
            <if test="module.ver != null">ver = #{module.ver,jdbcType=VARCHAR},</if>
            <if test="module.objtyp != null">objtyp = #{module.objtyp,jdbcType=VARCHAR},</if>
            <if test="module.objinr != null">objinr = #{module.objinr,jdbcType=VARCHAR},</if>
            <if test="module.sta != null">sta = #{module.sta,jdbcType=VARCHAR},</if>
            <if test="module.listopertype != null">listopertype = #{module.listopertype,jdbcType=VARCHAR},</if>
            <if test="module.csta != null">csta = #{module.csta,jdbcType=VARCHAR},</if>
            <if test="module.seqno != null">seqno = #{module.seqno,jdbcType=INTEGER},</if>
            <if test="module.buycurrencycode != null">buycurrencycode = #{module.buycurrencycode,jdbcType=VARCHAR},</if>
            <if test="module.buyamt != null">buyamt = #{module.buyamt,jdbcType=DECIMAL},</if>
            <if test="module.price != null">price = #{module.price,jdbcType=DECIMAL},</if>
            <if test="module.sellcurrencycode != null">sellcurrencycode = #{module.sellcurrencycode,jdbcType=VARCHAR},</if>
            <if test="module.sellamt != null">sellamt = #{module.sellamt,jdbcType=DECIMAL},</if>
            <if test="module.tradedate != null">tradedate = #{module.tradedate,jdbcType=DATE},</if>
            <if test="module.settledate != null">settledate = #{module.settledate,jdbcType=DATE},</if>
        </set>
        ${conditions}
    </update>

    <delete id="dyncDelete">
        ${sql}
    </delete>

    <select id="dyncRead" resultMap="BaseResultMap">
        ${sql}
    </select>

    <select id="selectByObjtypAndObjinr" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from tfc
        where 1=1 and objinr = #{objinr,jdbcType=VARCHAR} and objtyp = #{objtyp,jdbcType=VARCHAR}
    </select>

    <delete id="deleteByobjtypAndobjinr">
        delete from tfc
        where objtyp = #{objtyp,jdbcType=VARCHAR} and objinr = #{objinr,jdbcType=VARCHAR}
    </delete>
</mapper>