<?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.foreverwin.mesnac.common.mapper.ExportTemplateMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.foreverwin.mesnac.common.model.ExportTemplate">
        <id column="HANDLE" property="handle" />
        <result column="SITE" property="site" />
        <result column="TEMPLATE_CODE" property="templateCode" />
        <result column="TEMPLATE_DESC" property="templateDesc" />
        <result column="FILE_NAME" property="fileName" />
        <result column="COLUMN_SEQUENCE" property="columnSequence" />
        <result column="COLUMN_NAME" property="columnName" />
        <result column="LANGUAGE" property="language" />
        <result column="COLUMN_LABEL" property="columnLabel" />
        <result column="CREATE_USER_BO" property="createUserBo" />
        <result column="UPDATE_USER_BO" property="updateUserBo" />
        <result column="CREATED_DATE_TIME" property="createdDateTime" />
        <result column="UPDATED_DATE_TIME" property="updatedDateTime" />
        <result column="CONVERT_CLASS" property="convertClass" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        HANDLE, SITE, TEMPLATE_CODE, TEMPLATE_DESC, FILE_NAME, COLUMN_SEQUENCE, COLUMN_NAME, LANGUAGE, COLUMN_LABEL, CREATE_USER_BO, UPDATE_USER_BO, CREATED_DATE_TIME, UPDATED_DATE_TIME, CONVERT_CLASS
    </sql>

    <!-- BaseMapper标准查询/修改/删除 -->
    <select id="selectById" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List"></include> FROM Z_EXPORT_TEMPLATE WHERE HANDLE=#{handle}
    </select>

    <select id="selectByMap" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List"></include>
        FROM Z_EXPORT_TEMPLATE
        <if test="cm!=null and !cm.isEmpty">
            <where>
                <foreach collection="cm.keys" item="k" separator="AND">
                    <if test="cm[k] != null">
                        ${k} = #{cm[${k}]}
                    </if>
                </foreach>
            </where>
        </if>
    </select>

    <select id="selectBatchIds" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List"></include>
        FROM Z_EXPORT_TEMPLATE WHERE HANDLE IN (
        <foreach item="item" index="index" collection="coll" separator=",">#{item}
        </foreach>)
    </select>

    <select id="selectOne" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List"></include> FROM Z_EXPORT_TEMPLATE
        <where>
            <if test="ew.entity.handle!=null">
              HANDLE=#{ew.handle}
            </if>
            <if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
            <if test="ew.entity.templateCode!=null"> AND TEMPLATE_CODE=#{ew.entity.templateCode}</if>
            <if test="ew.entity.templateDesc!=null"> AND TEMPLATE_DESC=#{ew.entity.templateDesc}</if>
            <if test="ew.entity.fileName!=null"> AND FILE_NAME=#{ew.entity.fileName}</if>
            <if test="ew.entity.columnSequence!=null"> AND COLUMN_SEQUENCE=#{ew.entity.columnSequence}</if>
            <if test="ew.entity.columnName!=null"> AND COLUMN_NAME=#{ew.entity.columnName}</if>
            <if test="ew.entity.language!=null"> AND LANGUAGE=#{ew.entity.language}</if>
            <if test="ew.entity.columnLabel!=null"> AND COLUMN_LABEL=#{ew.entity.columnLabel}</if>
            <if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if>
            <if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if>
            <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
            <if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</if>
            <if test="ew.entity.convertClass!=null"> AND CONVERT_CLASS=#{ew.entity.convertClass}</if>
        </where>
    </select>

    <select id="selectCount" resultType="Integer">
        SELECT COUNT(1) FROM Z_EXPORT_TEMPLATE
        <where>
            <if test="ew!=null">
                <if test="ew.entity!=null">
                <if test="ew.entity.handle!=null">
                    HANDLE=#{ew.entity.handle}
                </if>
                <if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
                <if test="ew.entity.templateCode!=null"> AND TEMPLATE_CODE=#{ew.entity.templateCode}</if>
                <if test="ew.entity.templateDesc!=null"> AND TEMPLATE_DESC=#{ew.entity.templateDesc}</if>
                <if test="ew.entity.fileName!=null"> AND FILE_NAME=#{ew.entity.fileName}</if>
                <if test="ew.entity.columnSequence!=null"> AND COLUMN_SEQUENCE=#{ew.entity.columnSequence}</if>
                <if test="ew.entity.columnName!=null"> AND COLUMN_NAME=#{ew.entity.columnName}</if>
                <if test="ew.entity.language!=null"> AND LANGUAGE=#{ew.entity.language}</if>
                <if test="ew.entity.columnLabel!=null"> AND COLUMN_LABEL=#{ew.entity.columnLabel}</if>
                <if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if>
                <if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if>
                <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                <if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</if>
                <if test="ew.entity.convertClass!=null"> AND CONVERT_CLASS=#{ew.entity.convertClass}</if>
                </if>
                <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
                    ${ew.sqlSegment}
                </if>
            </if>
        </where>
        <if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
            ${ew.sqlSegment}
        </if>
    </select>

    <select id="selectList" resultMap="BaseResultMap">
        SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_EXPORT_TEMPLATE
        <where>
            <if test="ew!=null">
                <if test="ew.entity!=null">
                    <if test="ew.entity.handle!=null">
                        HANDLE=#{ew.entity.handle}
                    </if>
                    <if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
                    <if test="ew.entity.templateCode!=null"> AND TEMPLATE_CODE=#{ew.entity.templateCode}</if>
                    <if test="ew.entity.templateDesc!=null"> AND TEMPLATE_DESC=#{ew.entity.templateDesc}</if>
                    <if test="ew.entity.fileName!=null"> AND FILE_NAME=#{ew.entity.fileName}</if>
                    <if test="ew.entity.columnSequence!=null"> AND COLUMN_SEQUENCE=#{ew.entity.columnSequence}</if>
                    <if test="ew.entity.columnName!=null"> AND COLUMN_NAME=#{ew.entity.columnName}</if>
                    <if test="ew.entity.language!=null"> AND LANGUAGE=#{ew.entity.language}</if>
                    <if test="ew.entity.columnLabel!=null"> AND COLUMN_LABEL=#{ew.entity.columnLabel}</if>
                    <if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if>
                    <if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</if>
                    <if test="ew.entity.convertClass!=null"> AND CONVERT_CLASS=#{ew.entity.convertClass}</if>
                </if>
                <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
                    ${ew.sqlSegment}
                </if>
            </if>
        </where>
        <if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
            ${ew.sqlSegment}
        </if>
    </select>

    <select id="selectMaps" resultType="HashMap">
        SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_EXPORT_TEMPLATE
        <where>
            <if test="ew!=null">
                <if test="ew.entity!=null">
                    <if test="ew.entity.handle!=null">
                        HANDLE=#{ew.entity.handle}
                    </if>
                    <if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
                    <if test="ew.entity.templateCode!=null"> AND TEMPLATE_CODE=#{ew.entity.templateCode}</if>
                    <if test="ew.entity.templateDesc!=null"> AND TEMPLATE_DESC=#{ew.entity.templateDesc}</if>
                    <if test="ew.entity.fileName!=null"> AND FILE_NAME=#{ew.entity.fileName}</if>
                    <if test="ew.entity.columnSequence!=null"> AND COLUMN_SEQUENCE=#{ew.entity.columnSequence}</if>
                    <if test="ew.entity.columnName!=null"> AND COLUMN_NAME=#{ew.entity.columnName}</if>
                    <if test="ew.entity.language!=null"> AND LANGUAGE=#{ew.entity.language}</if>
                    <if test="ew.entity.columnLabel!=null"> AND COLUMN_LABEL=#{ew.entity.columnLabel}</if>
                    <if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if>
                    <if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</if>
                    <if test="ew.entity.convertClass!=null"> AND CONVERT_CLASS=#{ew.entity.convertClass}</if>
                </if>
                <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
                    ${ew.sqlSegment}
                </if>
            </if>
        </where>
        <if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
            ${ew.sqlSegment}
        </if>
    </select>

    <select id="selectObjs" resultType="Object">
        SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_EXPORT_TEMPLATE
        <where>
            <if test="ew!=null">
                <if test="ew.entity!=null">
                    <if test="ew.entity.handle!=null">
                        HANDLE=#{ew.entity.handle}
                    </if>
                    <if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
                    <if test="ew.entity.templateCode!=null"> AND TEMPLATE_CODE=#{ew.entity.templateCode}</if>
                    <if test="ew.entity.templateDesc!=null"> AND TEMPLATE_DESC=#{ew.entity.templateDesc}</if>
                    <if test="ew.entity.fileName!=null"> AND FILE_NAME=#{ew.entity.fileName}</if>
                    <if test="ew.entity.columnSequence!=null"> AND COLUMN_SEQUENCE=#{ew.entity.columnSequence}</if>
                    <if test="ew.entity.columnName!=null"> AND COLUMN_NAME=#{ew.entity.columnName}</if>
                    <if test="ew.entity.language!=null"> AND LANGUAGE=#{ew.entity.language}</if>
                    <if test="ew.entity.columnLabel!=null"> AND COLUMN_LABEL=#{ew.entity.columnLabel}</if>
                    <if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if>
                    <if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</if>
                    <if test="ew.entity.convertClass!=null"> AND CONVERT_CLASS=#{ew.entity.convertClass}</if>
                </if>
                <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
                    ${ew.sqlSegment}
                </if>
            </if>
        </where>
        <if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
            ${ew.sqlSegment}
        </if>
    </select>

    <select id="selectPage" resultMap="BaseResultMap">
        SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_EXPORT_TEMPLATE
        <where>
            <if test="ew!=null">
                <if test="ew.entity!=null">
                    <if test="ew.entity.handle!=null">
                        HANDLE=#{ew.entity.handle}
                    </if>
                    <if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
                    <if test="ew.entity.templateCode!=null"> AND TEMPLATE_CODE=#{ew.entity.templateCode}</if>
                    <if test="ew.entity.templateDesc!=null"> AND TEMPLATE_DESC=#{ew.entity.templateDesc}</if>
                    <if test="ew.entity.fileName!=null"> AND FILE_NAME=#{ew.entity.fileName}</if>
                    <if test="ew.entity.columnSequence!=null"> AND COLUMN_SEQUENCE=#{ew.entity.columnSequence}</if>
                    <if test="ew.entity.columnName!=null"> AND COLUMN_NAME=#{ew.entity.columnName}</if>
                    <if test="ew.entity.language!=null"> AND LANGUAGE=#{ew.entity.language}</if>
                    <if test="ew.entity.columnLabel!=null"> AND COLUMN_LABEL=#{ew.entity.columnLabel}</if>
                    <if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if>
                    <if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</if>
                    <if test="ew.entity.convertClass!=null"> AND CONVERT_CLASS=#{ew.entity.convertClass}</if>
                </if>
                <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
                    ${ew.sqlSegment}
                </if>
            </if>
        </where>
        <if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
            ${ew.sqlSegment}
        </if>
    </select>

    <select id="selectMapsPage" resultType="HashMap">
        SELECT <choose><when test="ew != null and ew.sqlSelect != null">${ew.sqlSelect}</when><otherwise><include refid="Base_Column_List"></include></otherwise></choose> FROM Z_EXPORT_TEMPLATE
        <where>
            <if test="ew!=null">
                <if test="ew.entity!=null">
                    <if test="ew.entity.handle!=null">
                        HANDLE=#{ew.entity.handle}
                    </if>
                    <if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
                    <if test="ew.entity.templateCode!=null"> AND TEMPLATE_CODE=#{ew.entity.templateCode}</if>
                    <if test="ew.entity.templateDesc!=null"> AND TEMPLATE_DESC=#{ew.entity.templateDesc}</if>
                    <if test="ew.entity.fileName!=null"> AND FILE_NAME=#{ew.entity.fileName}</if>
                    <if test="ew.entity.columnSequence!=null"> AND COLUMN_SEQUENCE=#{ew.entity.columnSequence}</if>
                    <if test="ew.entity.columnName!=null"> AND COLUMN_NAME=#{ew.entity.columnName}</if>
                    <if test="ew.entity.language!=null"> AND LANGUAGE=#{ew.entity.language}</if>
                    <if test="ew.entity.columnLabel!=null"> AND COLUMN_LABEL=#{ew.entity.columnLabel}</if>
                    <if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if>
                    <if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</if>
                    <if test="ew.entity.convertClass!=null"> AND CONVERT_CLASS=#{ew.entity.convertClass}</if>
                </if>
                <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
                    ${ew.sqlSegment}
                </if>
            </if>
        </where>
        <if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
            ${ew.sqlSegment}
        </if>
    </select>

    <insert id="insert" parameterType="com.foreverwin.mesnac.common.model.ExportTemplate">
        INSERT INTO Z_EXPORT_TEMPLATE
        <trim prefix="(" suffix=")" suffixOverrides=",">
            HANDLE,
            <if test="site!=null">SITE,</if>
            <if test="templateCode!=null">TEMPLATE_CODE,</if>
            <if test="templateDesc!=null">TEMPLATE_DESC,</if>
            <if test="fileName!=null">FILE_NAME,</if>
            <if test="columnSequence!=null">COLUMN_SEQUENCE,</if>
            <if test="columnName!=null">COLUMN_NAME,</if>
            <if test="language!=null">LANGUAGE,</if>
            <if test="columnLabel!=null">COLUMN_LABEL,</if>
            <if test="createUserBo!=null">CREATE_USER_BO,</if>
            <if test="updateUserBo!=null">UPDATE_USER_BO,</if>
            <if test="createdDateTime!=null">CREATED_DATE_TIME,</if>
            <if test="updatedDateTime!=null">UPDATED_DATE_TIME,</if>
            <if test="convertClass!=null">CONVERT_CLASS,</if>
        </trim> VALUES
        <trim prefix="(" suffix=")" suffixOverrides=",">
            #{handle},
            <if test="site!=null">#{site},</if>
            <if test="templateCode!=null">#{templateCode},</if>
            <if test="templateDesc!=null">#{templateDesc},</if>
            <if test="fileName!=null">#{fileName},</if>
            <if test="columnSequence!=null">#{columnSequence},</if>
            <if test="columnName!=null">#{columnName},</if>
            <if test="language!=null">#{language},</if>
            <if test="columnLabel!=null">#{columnLabel},</if>
            <if test="createUserBo!=null">#{createUserBo},</if>
            <if test="updateUserBo!=null">#{updateUserBo},</if>
            <if test="createdDateTime!=null">#{createdDateTime},</if>
            <if test="updatedDateTime!=null">#{updatedDateTime},</if>
            <if test="convertClass!=null">#{convertClass},</if>
        </trim>
    </insert>

    <insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.common.model.ExportTemplate">
        INSERT INTO Z_EXPORT_TEMPLATE
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <include refid="Base_Column_List"></include>
        </trim> VALUES
        <trim prefix="(" suffix=")" suffixOverrides=",">
            #{handle},
            #{site},
            #{templateCode},
            #{templateDesc},
            #{fileName},
            #{columnSequence},
            #{columnName},
            #{language},
            #{columnLabel},
            #{createUserBo},
            #{updateUserBo},
            #{createdDateTime},
            #{updatedDateTime},
            #{convertClass},
        </trim>
    </insert>


    <update id="updateById">
        UPDATE Z_EXPORT_TEMPLATE <trim prefix="SET" suffixOverrides=",">
        <if test="et.site!=null">SITE=#{et.site},</if>
        <if test="et.templateCode!=null">TEMPLATE_CODE=#{et.templateCode},</if>
        <if test="et.templateDesc!=null">TEMPLATE_DESC=#{et.templateDesc},</if>
        <if test="et.fileName!=null">FILE_NAME=#{et.fileName},</if>
        <if test="et.columnSequence!=null">COLUMN_SEQUENCE=#{et.columnSequence},</if>
        <if test="et.columnName!=null">COLUMN_NAME=#{et.columnName},</if>
        <if test="et.language!=null">LANGUAGE=#{et.language},</if>
        <if test="et.columnLabel!=null">COLUMN_LABEL=#{et.columnLabel},</if>
        <if test="et.createUserBo!=null">CREATE_USER_BO=#{et.createUserBo},</if>
        <if test="et.updateUserBo!=null">UPDATE_USER_BO=#{et.updateUserBo},</if>
        <if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
        <if test="et.updatedDateTime!=null">UPDATED_DATE_TIME=#{et.updatedDateTime},</if>
        <if test="et.convertClass!=null">CONVERT_CLASS=#{et.convertClass},</if>
        </trim> WHERE HANDLE=#{et.handle} <if test="et instanceof java.util.Map"><if test="et.MP_OPTLOCK_VERSION_ORIGINAL!=null">and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL}</if></if>
    </update>


    <update id="updateAllColumnById">
        UPDATE Z_EXPORT_TEMPLATE <trim prefix="SET" suffixOverrides=",">
        SITE=#{et.site},
        TEMPLATE_CODE=#{et.templateCode},
        TEMPLATE_DESC=#{et.templateDesc},
        FILE_NAME=#{et.fileName},
        COLUMN_SEQUENCE=#{et.columnSequence},
        COLUMN_NAME=#{et.columnName},
        LANGUAGE=#{et.language},
        COLUMN_LABEL=#{et.columnLabel},
        CREATE_USER_BO=#{et.createUserBo},
        UPDATE_USER_BO=#{et.updateUserBo},
        CREATED_DATE_TIME=#{et.createdDateTime},
        UPDATED_DATE_TIME=#{et.updatedDateTime},
        CONVERT_CLASS=#{et.convertClass},
     </trim> WHERE HANDLE=#{et.handle} <if test="et instanceof java.util.Map"><if test="et.MP_OPTLOCK_VERSION_ORIGINAL!=null">and ${et.MP_OPTLOCK_VERSION_COLUMN}=#{et.MP_OPTLOCK_VERSION_ORIGINAL}</if></if>
    </update>


    <update id="update">
        UPDATE Z_EXPORT_TEMPLATE <trim prefix="SET" suffixOverrides=",">
        <if test="et.site!=null">SITE=#{et.site},</if>
        <if test="et.templateCode!=null">TEMPLATE_CODE=#{et.templateCode},</if>
        <if test="et.templateDesc!=null">TEMPLATE_DESC=#{et.templateDesc},</if>
        <if test="et.fileName!=null">FILE_NAME=#{et.fileName},</if>
        <if test="et.columnSequence!=null">COLUMN_SEQUENCE=#{et.columnSequence},</if>
        <if test="et.columnName!=null">COLUMN_NAME=#{et.columnName},</if>
        <if test="et.language!=null">LANGUAGE=#{et.language},</if>
        <if test="et.columnLabel!=null">COLUMN_LABEL=#{et.columnLabel},</if>
        <if test="et.createUserBo!=null">CREATE_USER_BO=#{et.createUserBo},</if>
        <if test="et.updateUserBo!=null">UPDATE_USER_BO=#{et.updateUserBo},</if>
        <if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
        <if test="et.updatedDateTime!=null">UPDATED_DATE_TIME=#{et.updatedDateTime},</if>
        <if test="et.convertClass!=null">CONVERT_CLASS=#{et.convertClass},</if>
    </trim>
        <where>
            <if test="ew!=null">
                <if test="ew.entity!=null">
                    HANDLE=#{ew.entity.handle}
                    <if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
                    <if test="ew.entity.templateCode!=null"> AND TEMPLATE_CODE=#{ew.entity.templateCode}</if>
                    <if test="ew.entity.templateDesc!=null"> AND TEMPLATE_DESC=#{ew.entity.templateDesc}</if>
                    <if test="ew.entity.fileName!=null"> AND FILE_NAME=#{ew.entity.fileName}</if>
                    <if test="ew.entity.columnSequence!=null"> AND COLUMN_SEQUENCE=#{ew.entity.columnSequence}</if>
                    <if test="ew.entity.columnName!=null"> AND COLUMN_NAME=#{ew.entity.columnName}</if>
                    <if test="ew.entity.language!=null"> AND LANGUAGE=#{ew.entity.language}</if>
                    <if test="ew.entity.columnLabel!=null"> AND COLUMN_LABEL=#{ew.entity.columnLabel}</if>
                    <if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if>
                    <if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</if>
                    <if test="ew.entity.convertClass!=null"> AND CONVERT_CLASS=#{ew.entity.convertClass}</if>
                </if>
                <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
                    ${ew.sqlSegment}
                </if>
            </if>
        </where>
        <if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
            ${ew.sqlSegment}
        </if>
    </update>

    <delete id="deleteById">
        DELETE FROM Z_EXPORT_TEMPLATE WHERE HANDLE=#{handle}
    </delete>

    <delete id="deleteByMap">
        DELETE FROM Z_EXPORT_TEMPLATE
        <if test="cm!=null and !cm.isEmpty">
            <where>
                <foreach collection="cm.keys" item="k" separator="AND">
                    <if test="cm[k] != null">
                        ${k} = #{cm[${k}]}
                    </if>
                </foreach>
            </where>
        </if>
    </delete>

    <delete id="delete">
        DELETE FROM Z_EXPORT_TEMPLATE
        <where>
            <if test="ew!=null">
                <if test="ew.entity!=null">
                    <if test="ew.entity.handle!=null">
                        HANDLE=#{ew.entity.handle}
                    </if>
                    <if test="ew.entity.site!=null"> AND SITE=#{ew.entity.site}</if>
                    <if test="ew.entity.templateCode!=null"> AND TEMPLATE_CODE=#{ew.entity.templateCode}</if>
                    <if test="ew.entity.templateDesc!=null"> AND TEMPLATE_DESC=#{ew.entity.templateDesc}</if>
                    <if test="ew.entity.fileName!=null"> AND FILE_NAME=#{ew.entity.fileName}</if>
                    <if test="ew.entity.columnSequence!=null"> AND COLUMN_SEQUENCE=#{ew.entity.columnSequence}</if>
                    <if test="ew.entity.columnName!=null"> AND COLUMN_NAME=#{ew.entity.columnName}</if>
                    <if test="ew.entity.language!=null"> AND LANGUAGE=#{ew.entity.language}</if>
                    <if test="ew.entity.columnLabel!=null"> AND COLUMN_LABEL=#{ew.entity.columnLabel}</if>
                    <if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if>
                    <if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</if>
                    <if test="ew.entity.convertClass!=null"> AND CONVERT_CLASS=#{ew.entity.convertClass}</if>
                </if>
                <if test="ew!=null and ew.sqlSegment!=null and ew.nonEmptyOfWhere">
                    ${ew.sqlSegment}
                </if>
            </if>
        </where>
        <if test="ew!=null and ew.sqlSegment!=null and ew.emptyOfWhere">
            ${ew.sqlSegment}
        </if>
    </delete>

    <delete id="deleteBatchIds">
        DELETE FROM Z_EXPORT_TEMPLATE WHERE HANDLE IN (
        <foreach item="item" index="index" collection="coll" separator=",">#{item}
        </foreach>)
    </delete>
    <!-- BaseMapper标准查询/修改/删除 -->

</mapper>
