<?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="cokr.xit.ens.modules.common.ctgy.intgrnnoti.domain.repository.TmpltMngKkoAlimtalkMapper">

    <resultMap id="entityMap" type="cokr.xit.ens.modules.kkoalimtalk.domain.TmpltMngKkoAlimtalk">
        <result property="pryMessage" column="pry_message"/>
        <result property="biztalkOrgCd" column="biztalk_org_cd"/>
        <result property="biztalkTmpltCode" column="biztalk_tmplt_code"/>
        <result property="tmpltCd" column="tmplt_cd"/>
        <association property="orgMng" column="org_cd" javaType="cokr.xit.ens.modules.common.ctgy.sys.mng.domain.OrgMng">
            <id property="orgCd" column="org_cd"/>
        </association>
    </resultMap>
    <select id="findById" resultMap="entityMap">
        /* TmpltMngKkoAlimtalk.select */
        select pry_message
             , biztalk_org_cd
             , biztalk_tmplt_code
             , org_cd
             , tmplt_cd
        from ens_tmplt_mng_kko_at
        where 1 = 1
          and org_cd = #{orgMng}
          and tmplt_cd = #{tmpltCd}
    </select>


    <insert id="add">
        /* TmpltMngKkoAlimtalk.add */
        insert into ens_tmplt_mng_kko_at( pry_message
                                        , biztalk_org_cd
                                        , biztalk_tmplt_code
                                        , org_cd
                                        , tmplt_cd)
        values ( #{pryMessage}
               , #{biztalkOrgCd}
               , #{biztalkTmpltCode}
               , #{orgMng.orgCd}
               , #{tmpltCd})
    </insert>


    <update id="modify">
        /* TmpltMngKkoAlimtalk.modify */
        update ens_tmplt_mng_kko_at
        <set>
            <if test="pryMessage != null">pry_message = #{pryMessage},</if>
            <if test="biztalkOrgCd != null">biztalk_org_cd = #{biztalkOrgCd},</if>
            <if test="biztalkTmpltCode != null">biztalk_tmplt_code = #{biztalkTmpltCode},</if>
        </set>
        where 1=1
        and org_cd = #{orgMng.orgCd}
        and tmplt_cd = #{tmpltCd}
    </update>

</mapper>

