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

    <resultMap id="entityMap" type="cokr.xit.ens.modules.kkomydoc.domain.TmpltMngKkoMydoc">
        <result property="pryMessage" column="pry_message"/>
        <result property="ciTransUseYn" column="ci_trans_use_yn"/>
        <result property="csName" column="cs_name"/>
        <result property="csNumber" column="cs_number"/>
        <result property="tmpltCsInfoUseYn" column="tmplt_cs_info_use_yn"/>
        <result property="tmpltMsgUseYn" column="tmplt_msg_use_yn"/>
        <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">
        /* TmpltMngKkoMydoc.select */
        select pry_message
             , ci_trans_use_yn
             , cs_name
             , cs_number
             , org_cd
             , tmplt_cd
             , tmplt_cs_info_use_yn
             , tmplt_msg_use_yn
        from ens_tmplt_mng_kko_md
        where 1 = 1
          and org_cd = #{orgMng}
          and tmplt_cd = #{tmpltCd}
    </select>


    <insert id="add">
        /* TmpltMngKkoMydoc.add */
        insert into ens_tmplt_mng_kko_md( pry_message
                                        , ci_trans_use_yn
                                        , cs_name
                                        , cs_number
                                        , org_cd
                                        , tmplt_cd
                                        , tmplt_cs_info_use_yn
                                        , tmplt_msg_use_yn)
        values ( #{pryMessage}
               , #{ciTransUseYn}
               , #{csName}
               , #{csNumber}
               , #{orgMng.orgCd}
               , #{tmpltCd}
               , #{tmpltCsInfoUseYn}
               , #{tmpltMsgUseYn})
    </insert>


    <update id="modify">
        /* TmpltMngKkoMydoc.modify */
        update ens_tmplt_mng_kko_md
        <set>
            <if test="pryMessage != null">pry_message = #{pryMessage},</if>
            <if test="ciTransUseYn != null">ci_trans_use_yn = #{ciTransUseYn},</if>
            <if test="csName != null">cs_name = #{csName},</if>
            <if test="csNumber != null">cs_number = #{csNumber},</if>
            <if test="tmpltCsInfoUseYn != null">tmplt_cs_info_use_yn = #{tmpltCsInfoUseYn},</if>
            <if test="tmpltMsgUseYn != null">tmplt_msg_use_yn = #{tmpltMsgUseYn},</if>
        </set>
        where 1=1
        and org_cd = #{orgMng.orgCd}
        and tmplt_cd = #{tmpltCd}
    </update>


</mapper>

