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

    <resultMap id="BaseResultMap" type="com.brilliance.isc.bo.Blkmsg">
        <result property="id" column="id" jdbcType="VARCHAR"/>
        <result property="inr" column="inr" jdbcType="VARCHAR"/>
        <result property="chahgt" column="chahgt" jdbcType="VARCHAR"/>
        <result property="dir" column="dir" jdbcType="VARCHAR"/>
        <result property="msgid" column="msgid" jdbcType="VARCHAR"/>
        <result property="msgtyp" column="msgtyp" jdbcType="VARCHAR"/>
        <result property="sndkey" column="sndkey" jdbcType="VARCHAR"/>
        <result property="rcvkey" column="rcvkey" jdbcType="VARCHAR"/>
        <result property="credat" column="credat" jdbcType="VARCHAR"/>
        <result property="etyextkey" column="etyextkey" jdbcType="DECIMAL"/>
        <result property="chkflg" column="chkflg" jdbcType="DECIMAL"/>
        <result property="msgin" column="msgin" jdbcType="VARCHAR"/>
    </resultMap>

    <select id="getInrByMsgInfo" resultType="String">
        select inr from blkmsg
        where dir = #{dir,jdbcType=VARCHAR} and msgid = #{msgid,jdbcType=VARCHAR}
        <if test="sndkey != null and sndkey != ''">
            and sndkey = #{sndkey}
        </if>
        <if test="rcvkey != null and rcvkey != ''">
            and rcvkey = #{rcvkey}
        </if>
    </select>
    
    <select id="getCredatByInr">
        select credat from blkmsg where inr = #{inr}
    </select>

    <select id="dbCounter" resultType="String">
        select count(1) from blkmsg
    </select>
    
    <update id="updateByPrimaryKeySelective">
        update blkmsg
        <set>
            <if test="chahgt != null">objtyp = #{chahgt,jdbcType=VARCHAR},</if>
            <if test="dir != null">objtyp = #{dir,jdbcType=VARCHAR},</if>
            <if test="msgid != null">objtyp = #{msgid,jdbcType=VARCHAR},</if>
            <if test="msgtyp != null">objtyp = #{msgtyp,jdbcType=VARCHAR},</if>
            <if test="sndkey != null">objtyp = #{sndkey,jdbcType=VARCHAR},</if>
            <if test="rcvkey != null">objtyp = #{rcvkey,jdbcType=VARCHAR},</if>
            <if test="credat != null">objtyp = #{credat,jdbcType=VARCHAR},</if>
            <if test="etyextkey != null">objtyp = #{etyextkey,jdbcType=VARCHAR},</if>
            <if test="chkflg != null">objtyp = #{chkflg,jdbcType=VARCHAR},</if>
            <if test="msgin != null">objtyp = #{msgin,jdbcType=VARCHAR},</if>
        </set>
        where inr = #{inr,jdbcType=VARCHAR}
    </update>

</mapper>