<?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.NidcxmMapper">

    <resultMap id="BaseResultMap" type="com.brilliance.isc.bo.Nidcxm">
        <result property="inr" column="inr" jdbcType="VARCHAR"/>
        <result property="quycod" column="quycod" jdbcType="VARCHAR"/>
        <result property="ownref" column="ownref" jdbcType="VARCHAR"/>
        <result property="cur" column="cur" jdbcType="VARCHAR"/>
        <result property="amt" column="amt" jdbcType="DECIMAL"/>
        <result property="opndat" column="opndat" jdbcType="DATE"/>
        <result property="expdat" column="expdat" jdbcType="DATE"/>
        <result property="warran" column="warran" jdbcType="VARCHAR"/>
        <result property="benefi" column="benefi" jdbcType="VARCHAR"/>
        <result property="relflg" column="relflg" jdbcType="VARCHAR"/>
        <result property="comdat" column="comdat" jdbcType="DATE"/>
        <result property="inifrm" column="inifrm" jdbcType="VARCHAR"/>
        <result property="nidinr" column="nidinr" jdbcType="VARCHAR"/>
        <result property="trninr" column="trninr" jdbcType="VARCHAR"/>
        <result property="cxmflg" column="cxmflg" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List">
        inr,quycod,ownref,cur,amt,opndat,expdat,warran,benefi,relflg,comdat,inifrm,nidinr,trninr,cxmflg
    </sql>

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

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

    <insert id="insert">
        insert into nidcxm (<include refid="Base_Column_List"/>)
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            #{inr,jdbcType=VARCHAR},
            #{quycod,jdbcType=VARCHAR},
            #{ownref,jdbcType=VARCHAR},
            #{cur,jdbcType=VARCHAR},
            #{amt,jdbcType=DECIMAL},
            #{opndat,jdbcType=DATE},
            #{expdat,jdbcType=DATE},
            #{warran,jdbcType=VARCHAR},
            #{benefi,jdbcType=VARCHAR},
            #{relflg,jdbcType=VARCHAR},
            #{comdat,jdbcType=DATE},
            #{inifrm,jdbcType=VARCHAR},
            #{nidinr,jdbcType=VARCHAR},
            #{trninr,jdbcType=VARCHAR},
            #{cxmflg,jdbcType=VARCHAR},
        </trim>
    </insert>

    <insert id="insertSelective">
        insert into nidcxm
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="inr != null">inr,</if>
            <if test="quycod != null">quycod,</if>
            <if test="ownref != null">ownref,</if>
            <if test="cur != null">cur,</if>
            <if test="amt != null">amt,</if>
            <if test="opndat != null">opndat,</if>
            <if test="expdat != null">expdat,</if>
            <if test="warran != null">warran,</if>
            <if test="benefi != null">benefi,</if>
            <if test="relflg != null">relflg,</if>
            <if test="comdat != null">comdat,</if>
            <if test="inifrm != null">inifrm,</if>
            <if test="nidinr != null">nidinr,</if>
            <if test="trninr != null">trninr,</if>
            <if test="cxmflg != null">cxmflg,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="inr != null">#{inr,jdbcType=VARCHAR},</if>
            <if test="quycod != null">#{quycod,jdbcType=VARCHAR},</if>
            <if test="ownref != null">#{ownref,jdbcType=VARCHAR},</if>
            <if test="cur != null">#{cur,jdbcType=VARCHAR},</if>
            <if test="amt != null">#{amt,jdbcType=DECIMAL},</if>
            <if test="opndat != null">#{opndat,jdbcType=DATE},</if>
            <if test="expdat != null">#{expdat,jdbcType=DATE},</if>
            <if test="warran != null">#{warran,jdbcType=VARCHAR},</if>
            <if test="benefi != null">#{benefi,jdbcType=VARCHAR},</if>
            <if test="relflg != null">#{relflg,jdbcType=VARCHAR},</if>
            <if test="comdat != null">#{comdat,jdbcType=DATE},</if>
            <if test="inifrm != null">#{inifrm,jdbcType=VARCHAR},</if>
            <if test="nidinr != null">#{nidinr,jdbcType=VARCHAR},</if>
            <if test="trninr != null">#{trninr,jdbcType=VARCHAR},</if>
            <if test="cxmflg != null">#{cxmflg,jdbcType=VARCHAR},</if>
        </trim>
    </insert>

    <update id="updateByPrimaryKeySelective">
        update nidcxm
        <set>
            <if test="quycod != null">quycod = #{quycod,jdbcType=VARCHAR},</if>
            <if test="ownref != null">ownref = #{ownref,jdbcType=VARCHAR},</if>
            <if test="cur != null">cur = #{cur,jdbcType=VARCHAR},</if>
            <if test="amt != null">amt = #{amt,jdbcType=DECIMAL},</if>
            <if test="opndat != null">opndat = #{opndat,jdbcType=DATE},</if>
            <if test="expdat != null">expdat = #{expdat,jdbcType=DATE},</if>
            <if test="warran != null">warran = #{warran,jdbcType=VARCHAR},</if>
            <if test="benefi != null">benefi = #{benefi,jdbcType=VARCHAR},</if>
            <if test="relflg != null">relflg = #{relflg,jdbcType=VARCHAR},</if>
            <if test="comdat != null">comdat = #{comdat,jdbcType=DATE},</if>
            <if test="inifrm != null">inifrm = #{inifrm,jdbcType=VARCHAR},</if>
            <if test="nidinr != null">nidinr = #{nidinr,jdbcType=VARCHAR},</if>
            <if test="trninr != null">trninr = #{trninr,jdbcType=VARCHAR},</if>
            <if test="cxmflg != null">cxmflg = #{cxmflg,jdbcType=VARCHAR},</if>
        </set>
        where inr = #{inr,jdbcType=VARCHAR}
    </update>

    <update id="updateByPrimaryKey">
        update nidcxm
        <set>
            quycod = #{quycod,jdbcType=VARCHAR},
            ownref = #{ownref,jdbcType=VARCHAR},
            cur = #{cur,jdbcType=VARCHAR},
            amt = #{amt,jdbcType=DECIMAL},
            opndat = #{opndat,jdbcType=DATE},
            expdat = #{expdat,jdbcType=DATE},
            warran = #{warran,jdbcType=VARCHAR},
            benefi = #{benefi,jdbcType=VARCHAR},
            relflg = #{relflg,jdbcType=VARCHAR},
            comdat = #{comdat,jdbcType=DATE},
            inifrm = #{inifrm,jdbcType=VARCHAR},
            nidinr = #{nidinr,jdbcType=VARCHAR},
            trninr = #{trninr,jdbcType=VARCHAR},
            cxmflg = #{cxmflg,jdbcType=VARCHAR},
        </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 nidcxm
        <set>
            <if test="module.quycod != null">quycod = #{module.quycod,jdbcType=VARCHAR},</if>
            <if test="module.ownref != null">ownref = #{module.ownref,jdbcType=VARCHAR},</if>
            <if test="module.cur != null">cur = #{module.cur,jdbcType=VARCHAR},</if>
            <if test="module.amt != null">amt = #{module.amt,jdbcType=DECIMAL},</if>
            <if test="module.opndat != null">opndat = #{module.opndat,jdbcType=DATE},</if>
            <if test="module.expdat != null">expdat = #{module.expdat,jdbcType=DATE},</if>
            <if test="module.warran != null">warran = #{module.warran,jdbcType=VARCHAR},</if>
            <if test="module.benefi != null">benefi = #{module.benefi,jdbcType=VARCHAR},</if>
            <if test="module.relflg != null">relflg = #{module.relflg,jdbcType=VARCHAR},</if>
            <if test="module.comdat != null">comdat = #{module.comdat,jdbcType=DATE},</if>
            <if test="module.inifrm != null">inifrm = #{module.inifrm,jdbcType=VARCHAR},</if>
            <if test="module.nidinr != null">nidinr = #{module.nidinr,jdbcType=VARCHAR},</if>
            <if test="module.trninr != null">trninr = #{module.trninr,jdbcType=VARCHAR},</if>
            <if test="module.cxmflg != null">cxmflg = #{module.cxmflg,jdbcType=VARCHAR},</if>
        </set>
        ${conditions}
    </update>

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

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

    <select id="getByMaxInr" resultMap="BaseResultMap">
        select max(inr) from nidcxm where nidinr=#{inr}
    </select>

    <select id="selectNidcxmByNidInr" resultMap="BaseResultMap">
        select <include refid="Base_Column_List"/>
        from nidcxm
        where nidinr = #{nidinr,jdbcType=VARCHAR}
    </select>

</mapper>