<?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.dispatch.mapper.ItemBatchMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.foreverwin.mesnac.dispatch.model.ItemBatch">
        <id column="HANDLE" property="handle" />
        <result column="SITE" property="site" />
        <result column="FACTORY" property="factory" />
        <result column="ITEM" property="item" />
        <result column="BATCH" property="batch" />
        <result column="SPEC" property="spec" />
        <result column="TEXTURE" property="texture" />
        <result column="SUPPLIER" property="supplier" />
        <result column="LABEL" property="label" />
        <result column="IS_PRINT" property="isPrint" />
        <result column="CREATE_USER" property="createUser" />
        <result column="CREATED_DATE_TIME" property="createdDateTime" />
        <result column="MODIFY_USER" property="modifyUser" />
        <result column="MODIFIED_DATE_TIME" property="modifiedDateTime" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        HANDLE, SITE, FACTORY, ITEM, BATCH, SPEC, TEXTURE, SUPPLIER, LABEL, IS_PRINT, CREATE_USER, CREATED_DATE_TIME, MODIFY_USER, MODIFIED_DATE_TIME
    </sql>

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

    <select id="selectByMap" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List"></include>
        FROM Z_ITEM_BATCH
        <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_ITEM_BATCH 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_ITEM_BATCH
        <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.factory!=null"> AND FACTORY=#{ew.entity.factory}</if>
            <if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
            <if test="ew.entity.batch!=null"> AND BATCH=#{ew.entity.batch}</if>
            <if test="ew.entity.spec!=null"> AND SPEC=#{ew.entity.spec}</if>
            <if test="ew.entity.texture!=null"> AND TEXTURE=#{ew.entity.texture}</if>
            <if test="ew.entity.supplier!=null"> AND SUPPLIER=#{ew.entity.supplier}</if>
            <if test="ew.entity.label!=null"> AND LABEL=#{ew.entity.label}</if>
            <if test="ew.entity.isPrint!=null"> AND IS_PRINT=#{ew.entity.isPrint}</if>
            <if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
            <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
            <if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
            <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</if>
        </where>
    </select>

    <select id="selectCount" resultType="Integer">
        SELECT COUNT(1) FROM Z_ITEM_BATCH
        <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.factory!=null"> AND FACTORY=#{ew.entity.factory}</if>
                <if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
                <if test="ew.entity.batch!=null"> AND BATCH=#{ew.entity.batch}</if>
                <if test="ew.entity.spec!=null"> AND SPEC=#{ew.entity.spec}</if>
                <if test="ew.entity.texture!=null"> AND TEXTURE=#{ew.entity.texture}</if>
                <if test="ew.entity.supplier!=null"> AND SUPPLIER=#{ew.entity.supplier}</if>
                <if test="ew.entity.label!=null"> AND LABEL=#{ew.entity.label}</if>
                <if test="ew.entity.isPrint!=null"> AND IS_PRINT=#{ew.entity.isPrint}</if>
                <if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
                <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                <if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
                <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</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_ITEM_BATCH
        <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.factory!=null"> AND FACTORY=#{ew.entity.factory}</if>
                    <if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
                    <if test="ew.entity.batch!=null"> AND BATCH=#{ew.entity.batch}</if>
                    <if test="ew.entity.spec!=null"> AND SPEC=#{ew.entity.spec}</if>
                    <if test="ew.entity.texture!=null"> AND TEXTURE=#{ew.entity.texture}</if>
                    <if test="ew.entity.supplier!=null"> AND SUPPLIER=#{ew.entity.supplier}</if>
                    <if test="ew.entity.label!=null"> AND LABEL=#{ew.entity.label}</if>
                    <if test="ew.entity.isPrint!=null"> AND IS_PRINT=#{ew.entity.isPrint}</if>
                    <if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
                    <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</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_ITEM_BATCH
        <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.factory!=null"> AND FACTORY=#{ew.entity.factory}</if>
                    <if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
                    <if test="ew.entity.batch!=null"> AND BATCH=#{ew.entity.batch}</if>
                    <if test="ew.entity.spec!=null"> AND SPEC=#{ew.entity.spec}</if>
                    <if test="ew.entity.texture!=null"> AND TEXTURE=#{ew.entity.texture}</if>
                    <if test="ew.entity.supplier!=null"> AND SUPPLIER=#{ew.entity.supplier}</if>
                    <if test="ew.entity.label!=null"> AND LABEL=#{ew.entity.label}</if>
                    <if test="ew.entity.isPrint!=null"> AND IS_PRINT=#{ew.entity.isPrint}</if>
                    <if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
                    <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</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_ITEM_BATCH
        <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.factory!=null"> AND FACTORY=#{ew.entity.factory}</if>
                    <if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
                    <if test="ew.entity.batch!=null"> AND BATCH=#{ew.entity.batch}</if>
                    <if test="ew.entity.spec!=null"> AND SPEC=#{ew.entity.spec}</if>
                    <if test="ew.entity.texture!=null"> AND TEXTURE=#{ew.entity.texture}</if>
                    <if test="ew.entity.supplier!=null"> AND SUPPLIER=#{ew.entity.supplier}</if>
                    <if test="ew.entity.label!=null"> AND LABEL=#{ew.entity.label}</if>
                    <if test="ew.entity.isPrint!=null"> AND IS_PRINT=#{ew.entity.isPrint}</if>
                    <if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
                    <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</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_ITEM_BATCH
        <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.factory!=null"> AND FACTORY=#{ew.entity.factory}</if>
                    <if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
                    <if test="ew.entity.batch!=null"> AND BATCH=#{ew.entity.batch}</if>
                    <if test="ew.entity.spec!=null"> AND SPEC=#{ew.entity.spec}</if>
                    <if test="ew.entity.texture!=null"> AND TEXTURE=#{ew.entity.texture}</if>
                    <if test="ew.entity.supplier!=null"> AND SUPPLIER=#{ew.entity.supplier}</if>
                    <if test="ew.entity.label!=null"> AND LABEL=#{ew.entity.label}</if>
                    <if test="ew.entity.isPrint!=null"> AND IS_PRINT=#{ew.entity.isPrint}</if>
                    <if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
                    <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</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_ITEM_BATCH
        <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.factory!=null"> AND FACTORY=#{ew.entity.factory}</if>
                    <if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
                    <if test="ew.entity.batch!=null"> AND BATCH=#{ew.entity.batch}</if>
                    <if test="ew.entity.spec!=null"> AND SPEC=#{ew.entity.spec}</if>
                    <if test="ew.entity.texture!=null"> AND TEXTURE=#{ew.entity.texture}</if>
                    <if test="ew.entity.supplier!=null"> AND SUPPLIER=#{ew.entity.supplier}</if>
                    <if test="ew.entity.label!=null"> AND LABEL=#{ew.entity.label}</if>
                    <if test="ew.entity.isPrint!=null"> AND IS_PRINT=#{ew.entity.isPrint}</if>
                    <if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
                    <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</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.dispatch.model.ItemBatch">
        INSERT INTO Z_ITEM_BATCH
        <trim prefix="(" suffix=")" suffixOverrides=",">
            HANDLE,
            <if test="site!=null">SITE,</if>
            <if test="factory!=null">FACTORY,</if>
            <if test="item!=null">ITEM,</if>
            <if test="batch!=null">BATCH,</if>
            <if test="spec!=null">SPEC,</if>
            <if test="texture!=null">TEXTURE,</if>
            <if test="supplier!=null">SUPPLIER,</if>
            <if test="label!=null">LABEL,</if>
            <if test="isPrint!=null">IS_PRINT,</if>
            <if test="createUser!=null">CREATE_USER,</if>
            <if test="createdDateTime!=null">CREATED_DATE_TIME,</if>
            <if test="modifyUser!=null">MODIFY_USER,</if>
            <if test="modifiedDateTime!=null">MODIFIED_DATE_TIME,</if>
        </trim> VALUES
        <trim prefix="(" suffix=")" suffixOverrides=",">
            #{handle},
            <if test="site!=null">#{site},</if>
            <if test="factory!=null">#{factory},</if>
            <if test="item!=null">#{item},</if>
            <if test="batch!=null">#{batch},</if>
            <if test="spec!=null">#{spec},</if>
            <if test="texture!=null">#{texture},</if>
            <if test="supplier!=null">#{supplier},</if>
            <if test="label!=null">#{label},</if>
            <if test="isPrint!=null">#{isPrint},</if>
            <if test="createUser!=null">#{createUser},</if>
            <if test="createdDateTime!=null">#{createdDateTime},</if>
            <if test="modifyUser!=null">#{modifyUser},</if>
            <if test="modifiedDateTime!=null">#{modifiedDateTime},</if>
        </trim>
    </insert>

    <insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.dispatch.model.ItemBatch">
        INSERT INTO Z_ITEM_BATCH
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <include refid="Base_Column_List"></include>
        </trim> VALUES
        <trim prefix="(" suffix=")" suffixOverrides=",">
            #{handle},
            #{site},
            #{factory},
            #{item},
            #{batch},
            #{spec},
            #{texture},
            #{supplier},
            #{label},
            #{isPrint},
            #{createUser},
            #{createdDateTime},
            #{modifyUser},
            #{modifiedDateTime},
        </trim>
    </insert>


    <update id="updateById">
        UPDATE Z_ITEM_BATCH <trim prefix="SET" suffixOverrides=",">
        <if test="et.site!=null">SITE=#{et.site},</if>
        <if test="et.factory!=null">FACTORY=#{et.factory},</if>
        <if test="et.item!=null">ITEM=#{et.item},</if>
        <if test="et.batch!=null">BATCH=#{et.batch},</if>
        <if test="et.spec!=null">SPEC=#{et.spec},</if>
        <if test="et.texture!=null">TEXTURE=#{et.texture},</if>
        <if test="et.supplier!=null">SUPPLIER=#{et.supplier},</if>
        <if test="et.label!=null">LABEL=#{et.label},</if>
        <if test="et.isPrint!=null">IS_PRINT=#{et.isPrint},</if>
        <if test="et.createUser!=null">CREATE_USER=#{et.createUser},</if>
        <if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
        <if test="et.modifyUser!=null">MODIFY_USER=#{et.modifyUser},</if>
        <if test="et.modifiedDateTime!=null">MODIFIED_DATE_TIME=#{et.modifiedDateTime},</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_ITEM_BATCH <trim prefix="SET" suffixOverrides=",">
        SITE=#{et.site},
        FACTORY=#{et.factory},
        ITEM=#{et.item},
        BATCH=#{et.batch},
        SPEC=#{et.spec},
        TEXTURE=#{et.texture},
        SUPPLIER=#{et.supplier},
        LABEL=#{et.label},
        IS_PRINT=#{et.isPrint},
        CREATE_USER=#{et.createUser},
        CREATED_DATE_TIME=#{et.createdDateTime},
        MODIFY_USER=#{et.modifyUser},
        MODIFIED_DATE_TIME=#{et.modifiedDateTime},
     </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_ITEM_BATCH <trim prefix="SET" suffixOverrides=",">
        <if test="et.site!=null">SITE=#{et.site},</if>
        <if test="et.factory!=null">FACTORY=#{et.factory},</if>
        <if test="et.item!=null">ITEM=#{et.item},</if>
        <if test="et.batch!=null">BATCH=#{et.batch},</if>
        <if test="et.spec!=null">SPEC=#{et.spec},</if>
        <if test="et.texture!=null">TEXTURE=#{et.texture},</if>
        <if test="et.supplier!=null">SUPPLIER=#{et.supplier},</if>
        <if test="et.label!=null">LABEL=#{et.label},</if>
        <if test="et.isPrint!=null">IS_PRINT=#{et.isPrint},</if>
        <if test="et.createUser!=null">CREATE_USER=#{et.createUser},</if>
        <if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
        <if test="et.modifyUser!=null">MODIFY_USER=#{et.modifyUser},</if>
        <if test="et.modifiedDateTime!=null">MODIFIED_DATE_TIME=#{et.modifiedDateTime},</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.factory!=null"> AND FACTORY=#{ew.entity.factory}</if>
                    <if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
                    <if test="ew.entity.batch!=null"> AND BATCH=#{ew.entity.batch}</if>
                    <if test="ew.entity.spec!=null"> AND SPEC=#{ew.entity.spec}</if>
                    <if test="ew.entity.texture!=null"> AND TEXTURE=#{ew.entity.texture}</if>
                    <if test="ew.entity.supplier!=null"> AND SUPPLIER=#{ew.entity.supplier}</if>
                    <if test="ew.entity.label!=null"> AND LABEL=#{ew.entity.label}</if>
                    <if test="ew.entity.isPrint!=null"> AND IS_PRINT=#{ew.entity.isPrint}</if>
                    <if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
                    <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</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_ITEM_BATCH WHERE HANDLE=#{handle}
    </delete>

    <delete id="deleteByMap">
        DELETE FROM Z_ITEM_BATCH
        <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_ITEM_BATCH
        <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.factory!=null"> AND FACTORY=#{ew.entity.factory}</if>
                    <if test="ew.entity.item!=null"> AND ITEM=#{ew.entity.item}</if>
                    <if test="ew.entity.batch!=null"> AND BATCH=#{ew.entity.batch}</if>
                    <if test="ew.entity.spec!=null"> AND SPEC=#{ew.entity.spec}</if>
                    <if test="ew.entity.texture!=null"> AND TEXTURE=#{ew.entity.texture}</if>
                    <if test="ew.entity.supplier!=null"> AND SUPPLIER=#{ew.entity.supplier}</if>
                    <if test="ew.entity.label!=null"> AND LABEL=#{ew.entity.label}</if>
                    <if test="ew.entity.isPrint!=null"> AND IS_PRINT=#{ew.entity.isPrint}</if>
                    <if test="ew.entity.createUser!=null"> AND CREATE_USER=#{ew.entity.createUser}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.modifyUser!=null"> AND MODIFY_USER=#{ew.entity.modifyUser}</if>
                    <if test="ew.entity.modifiedDateTime!=null"> AND MODIFIED_DATE_TIME=#{ew.entity.modifiedDateTime}</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_ITEM_BATCH WHERE HANDLE IN (
        <foreach item="item" index="index" collection="coll" separator=",">#{item}
        </foreach>)
    </delete>
    <!-- BaseMapper标准查询/修改/删除 -->

</mapper>
