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

    <resultMap id="BaseResultMap" type="com.brilliance.isc.bo.Ucl">
        <result property="usrdef" column="usrdef" jdbcType="VARCHAR"/>
        <result property="usr" column="usr" jdbcType="VARCHAR"/>
        <result property="mannam" column="mannam" jdbcType="VARCHAR"/>
        <result property="branchinr" column="branchinr" jdbcType="VARCHAR"/>
        <result property="objlst" column="objlst" jdbcType="VARCHAR"/>
        <result property="assignflg" column="assignflg" jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List">
        usrdef,usr,mannam,branchinr,objlst,assignflg
    </sql>

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

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

    <insert id="insert">
        insert into ucl (<include refid="Base_Column_List" />)
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            #{usrdef,jdbcType=VARCHAR},
            #{usr,jdbcType=VARCHAR},
            #{mannam,jdbcType=VARCHAR},
            #{branchinr,jdbcType=VARCHAR},
            #{objlst,jdbcType=VARCHAR},
            #{assignflg,jdbcType=VARCHAR},
        </trim>
    </insert>

    <insert id="insertSelective">
        insert into ucl
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="usrdef != null">usrdef,</if>
            <if test="usr != null">usr,</if>
            <if test="mannam != null">mannam,</if>
            <if test="branchinr != null">branchinr,</if>
            <if test="objlst != null">objlst,</if>
            <if test="assignflg != null">assignflg,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="usrdef != null">#{usrdef,jdbcType=VARCHAR}, </if>
            <if test="usr != null">#{usr,jdbcType=VARCHAR}, </if>
            <if test="mannam != null">#{mannam,jdbcType=VARCHAR}, </if>
            <if test="branchinr != null">#{branchinr,jdbcType=VARCHAR}, </if>
            <if test="objlst != null">#{objlst,jdbcType=VARCHAR}, </if>
            <if test="assignflg != null">#{assignflg,jdbcType=VARCHAR}, </if>
        </trim>
    </insert>

    <update id="updateByPrimaryKeySelective">
        update ucl
        <set>
            <if test="usrdef != null">usrdef = #{usrdef,jdbcType=VARCHAR},</if>
            <if test="usr != null">usr = #{usr,jdbcType=VARCHAR},</if>
            <if test="mannam != null">mannam = #{mannam,jdbcType=VARCHAR},</if>
            <if test="branchinr != null">branchinr = #{branchinr,jdbcType=VARCHAR},</if>
            <if test="objlst != null">objlst = #{objlst,jdbcType=VARCHAR},</if>
            <if test="assignflg != null">assignflg = #{assignflg,jdbcType=VARCHAR},</if>
        </set>
        where inr = #{inr,jdbcType=VARCHAR}
    </update>

    <update id="updateByPrimaryKey">
        update ucl
        <set>
            usrdef = #{usrdef,jdbcType=VARCHAR},
            usr = #{usr,jdbcType=VARCHAR},
            mannam = #{mannam,jdbcType=VARCHAR},
            branchinr = #{branchinr,jdbcType=VARCHAR},
            objlst = #{objlst,jdbcType=VARCHAR},
            assignflg = #{assignflg,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 ucl
        <set>
            <if test="module.usrdef != null">usrdef = #{module.usrdef,jdbcType=VARCHAR},</if>
            <if test="module.usr != null">usr = #{module.usr,jdbcType=VARCHAR},</if>
            <if test="module.mannam != null">mannam = #{module.mannam,jdbcType=VARCHAR},</if>
            <if test="module.branchinr != null">branchinr = #{module.branchinr,jdbcType=VARCHAR},</if>
            <if test="module.objlst != null">objlst = #{module.objlst,jdbcType=VARCHAR},</if>
            <if test="module.assignflg != null">assignflg = #{module.assignflg,jdbcType=VARCHAR},</if>
        </set>
        ${conditions}
    </update>

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

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

    <select id="getDefaultUclByUsr" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from ucl
        where trim(usr) = #{usr,jdbcType=VARCHAR}
        and usrdef = 'X'
    </select>

</mapper>