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

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.foreverwin.mesnac.dispatch.model.CallItem">
        <id column="HANDLE" property="handle" />
        <result column="SITE" property="site" />
        <result column="CALL_ITEM_NO" property="callItemNo" />
        <result column="SHOP_ORDER" property="shopOrder" />
        <result column="SFC" property="sfc" />
        <result column="DISPATCH_NO" property="dispatchNo" />
        <result column="OPERATION" property="operation" />
        <result column="STEP_ID" property="stepId" />
        <result column="RESRCE" property="resrce" />
        <result column="COMPONENT_BO" property="componentBo" />
        <result column="CALL_TYPE" property="callType" />
        <result column="REQUIRED_QTY" property="requiredQty" />
        <result column="REQUIRED_DATE_TIME" property="requiredDateTime" />
        <result column="STATUS" property="status" />
        <result column="CALL_STATUS" property="callStatus" />
        <result column="SEND_STATUS" property="sendStatus" />
        <result column="CREATE_USER_BO" property="createUserBo" />
        <result column="CREATED_DATE_TIME" property="createdDateTime" />
        <result column="UPDATE_USER_BO" property="updateUserBo" />
        <result column="UPDATED_DATE_TIME" property="updatedDateTime" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        HANDLE, SITE, CALL_ITEM_NO, SHOP_ORDER, SFC, DISPATCH_NO, OPERATION, STEP_ID, RESRCE, COMPONENT_BO, CALL_TYPE, REQUIRED_QTY, REQUIRED_DATE_TIME, STATUS, CALL_STATUS, SEND_STATUS, CREATE_USER_BO, CREATED_DATE_TIME, UPDATE_USER_BO, UPDATED_DATE_TIME
    </sql>

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

    <select id="selectByMap" resultMap="BaseResultMap">
        SELECT <include refid="Base_Column_List"></include>
        FROM Z_CALL_ITEM
        <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_CALL_ITEM 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_CALL_ITEM
        <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.callItemNo!=null"> AND CALL_ITEM_NO=#{ew.entity.callItemNo}</if>
            <if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
            <if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
            <if test="ew.entity.dispatchNo!=null"> AND DISPATCH_NO=#{ew.entity.dispatchNo}</if>
            <if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
            <if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
            <if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
            <if test="ew.entity.componentBo!=null"> AND COMPONENT_BO=#{ew.entity.componentBo}</if>
            <if test="ew.entity.callType!=null"> AND CALL_TYPE=#{ew.entity.callType}</if>
            <if test="ew.entity.requiredQty!=null"> AND REQUIRED_QTY=#{ew.entity.requiredQty}</if>
            <if test="ew.entity.requiredDateTime!=null"> AND REQUIRED_DATE_TIME=#{ew.entity.requiredDateTime}</if>
            <if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
            <if test="ew.entity.callStatus!=null"> AND CALL_STATUS=#{ew.entity.callStatus}</if>
            <if test="ew.entity.sendStatus!=null"> AND SEND_STATUS=#{ew.entity.sendStatus}</if>
            <if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if>
            <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
            <if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if>
            <if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</if>
        </where>
    </select>

    <select id="selectCount" resultType="Integer">
        SELECT COUNT(1) FROM Z_CALL_ITEM
        <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.callItemNo!=null"> AND CALL_ITEM_NO=#{ew.entity.callItemNo}</if>
                <if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
                <if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
                <if test="ew.entity.dispatchNo!=null"> AND DISPATCH_NO=#{ew.entity.dispatchNo}</if>
                <if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
                <if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
                <if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
                <if test="ew.entity.componentBo!=null"> AND COMPONENT_BO=#{ew.entity.componentBo}</if>
                <if test="ew.entity.callType!=null"> AND CALL_TYPE=#{ew.entity.callType}</if>
                <if test="ew.entity.requiredQty!=null"> AND REQUIRED_QTY=#{ew.entity.requiredQty}</if>
                <if test="ew.entity.requiredDateTime!=null"> AND REQUIRED_DATE_TIME=#{ew.entity.requiredDateTime}</if>
                <if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
                <if test="ew.entity.callStatus!=null"> AND CALL_STATUS=#{ew.entity.callStatus}</if>
                <if test="ew.entity.sendStatus!=null"> AND SEND_STATUS=#{ew.entity.sendStatus}</if>
                <if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if>
                <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                <if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if>
                <if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</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_CALL_ITEM
        <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.callItemNo!=null"> AND CALL_ITEM_NO=#{ew.entity.callItemNo}</if>
                    <if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
                    <if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
                    <if test="ew.entity.dispatchNo!=null"> AND DISPATCH_NO=#{ew.entity.dispatchNo}</if>
                    <if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
                    <if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
                    <if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
                    <if test="ew.entity.componentBo!=null"> AND COMPONENT_BO=#{ew.entity.componentBo}</if>
                    <if test="ew.entity.callType!=null"> AND CALL_TYPE=#{ew.entity.callType}</if>
                    <if test="ew.entity.requiredQty!=null"> AND REQUIRED_QTY=#{ew.entity.requiredQty}</if>
                    <if test="ew.entity.requiredDateTime!=null"> AND REQUIRED_DATE_TIME=#{ew.entity.requiredDateTime}</if>
                    <if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
                    <if test="ew.entity.callStatus!=null"> AND CALL_STATUS=#{ew.entity.callStatus}</if>
                    <if test="ew.entity.sendStatus!=null"> AND SEND_STATUS=#{ew.entity.sendStatus}</if>
                    <if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if>
                    <if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</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_CALL_ITEM
        <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.callItemNo!=null"> AND CALL_ITEM_NO=#{ew.entity.callItemNo}</if>
                    <if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
                    <if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
                    <if test="ew.entity.dispatchNo!=null"> AND DISPATCH_NO=#{ew.entity.dispatchNo}</if>
                    <if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
                    <if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
                    <if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
                    <if test="ew.entity.componentBo!=null"> AND COMPONENT_BO=#{ew.entity.componentBo}</if>
                    <if test="ew.entity.callType!=null"> AND CALL_TYPE=#{ew.entity.callType}</if>
                    <if test="ew.entity.requiredQty!=null"> AND REQUIRED_QTY=#{ew.entity.requiredQty}</if>
                    <if test="ew.entity.requiredDateTime!=null"> AND REQUIRED_DATE_TIME=#{ew.entity.requiredDateTime}</if>
                    <if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
                    <if test="ew.entity.callStatus!=null"> AND CALL_STATUS=#{ew.entity.callStatus}</if>
                    <if test="ew.entity.sendStatus!=null"> AND SEND_STATUS=#{ew.entity.sendStatus}</if>
                    <if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if>
                    <if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</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_CALL_ITEM
        <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.callItemNo!=null"> AND CALL_ITEM_NO=#{ew.entity.callItemNo}</if>
                    <if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
                    <if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
                    <if test="ew.entity.dispatchNo!=null"> AND DISPATCH_NO=#{ew.entity.dispatchNo}</if>
                    <if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
                    <if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
                    <if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
                    <if test="ew.entity.componentBo!=null"> AND COMPONENT_BO=#{ew.entity.componentBo}</if>
                    <if test="ew.entity.callType!=null"> AND CALL_TYPE=#{ew.entity.callType}</if>
                    <if test="ew.entity.requiredQty!=null"> AND REQUIRED_QTY=#{ew.entity.requiredQty}</if>
                    <if test="ew.entity.requiredDateTime!=null"> AND REQUIRED_DATE_TIME=#{ew.entity.requiredDateTime}</if>
                    <if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
                    <if test="ew.entity.callStatus!=null"> AND CALL_STATUS=#{ew.entity.callStatus}</if>
                    <if test="ew.entity.sendStatus!=null"> AND SEND_STATUS=#{ew.entity.sendStatus}</if>
                    <if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if>
                    <if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</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_CALL_ITEM
        <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.callItemNo!=null"> AND CALL_ITEM_NO=#{ew.entity.callItemNo}</if>
                    <if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
                    <if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
                    <if test="ew.entity.dispatchNo!=null"> AND DISPATCH_NO=#{ew.entity.dispatchNo}</if>
                    <if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
                    <if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
                    <if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
                    <if test="ew.entity.componentBo!=null"> AND COMPONENT_BO=#{ew.entity.componentBo}</if>
                    <if test="ew.entity.callType!=null"> AND CALL_TYPE=#{ew.entity.callType}</if>
                    <if test="ew.entity.requiredQty!=null"> AND REQUIRED_QTY=#{ew.entity.requiredQty}</if>
                    <if test="ew.entity.requiredDateTime!=null"> AND REQUIRED_DATE_TIME=#{ew.entity.requiredDateTime}</if>
                    <if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
                    <if test="ew.entity.callStatus!=null"> AND CALL_STATUS=#{ew.entity.callStatus}</if>
                    <if test="ew.entity.sendStatus!=null"> AND SEND_STATUS=#{ew.entity.sendStatus}</if>
                    <if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if>
                    <if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</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_CALL_ITEM
        <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.callItemNo!=null"> AND CALL_ITEM_NO=#{ew.entity.callItemNo}</if>
                    <if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
                    <if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
                    <if test="ew.entity.dispatchNo!=null"> AND DISPATCH_NO=#{ew.entity.dispatchNo}</if>
                    <if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
                    <if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
                    <if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
                    <if test="ew.entity.componentBo!=null"> AND COMPONENT_BO=#{ew.entity.componentBo}</if>
                    <if test="ew.entity.callType!=null"> AND CALL_TYPE=#{ew.entity.callType}</if>
                    <if test="ew.entity.requiredQty!=null"> AND REQUIRED_QTY=#{ew.entity.requiredQty}</if>
                    <if test="ew.entity.requiredDateTime!=null"> AND REQUIRED_DATE_TIME=#{ew.entity.requiredDateTime}</if>
                    <if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
                    <if test="ew.entity.callStatus!=null"> AND CALL_STATUS=#{ew.entity.callStatus}</if>
                    <if test="ew.entity.sendStatus!=null"> AND SEND_STATUS=#{ew.entity.sendStatus}</if>
                    <if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if>
                    <if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</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.CallItem">
        INSERT INTO Z_CALL_ITEM
        <trim prefix="(" suffix=")" suffixOverrides=",">
            HANDLE,
            <if test="site!=null">SITE,</if>
            <if test="callItemNo!=null">CALL_ITEM_NO,</if>
            <if test="shopOrder!=null">SHOP_ORDER,</if>
            <if test="sfc!=null">SFC,</if>
            <if test="dispatchNo!=null">DISPATCH_NO,</if>
            <if test="operation!=null">OPERATION,</if>
            <if test="stepId!=null">STEP_ID,</if>
            <if test="resrce!=null">RESRCE,</if>
            <if test="componentBo!=null">COMPONENT_BO,</if>
            <if test="callType!=null">CALL_TYPE,</if>
            <if test="requiredQty!=null">REQUIRED_QTY,</if>
            <if test="requiredDateTime!=null">REQUIRED_DATE_TIME,</if>
            <if test="status!=null">STATUS,</if>
            <if test="callStatus!=null">CALL_STATUS,</if>
            <if test="sendStatus!=null">SEND_STATUS,</if>
            <if test="createUserBo!=null">CREATE_USER_BO,</if>
            <if test="createdDateTime!=null">CREATED_DATE_TIME,</if>
            <if test="updateUserBo!=null">UPDATE_USER_BO,</if>
            <if test="updatedDateTime!=null">UPDATED_DATE_TIME,</if>
        </trim> VALUES
        <trim prefix="(" suffix=")" suffixOverrides=",">
            #{handle},
            <if test="site!=null">#{site},</if>
            <if test="callItemNo!=null">#{callItemNo},</if>
            <if test="shopOrder!=null">#{shopOrder},</if>
            <if test="sfc!=null">#{sfc},</if>
            <if test="dispatchNo!=null">#{dispatchNo},</if>
            <if test="operation!=null">#{operation},</if>
            <if test="stepId!=null">#{stepId},</if>
            <if test="resrce!=null">#{resrce},</if>
            <if test="componentBo!=null">#{componentBo},</if>
            <if test="callType!=null">#{callType},</if>
            <if test="requiredQty!=null">#{requiredQty},</if>
            <if test="requiredDateTime!=null">#{requiredDateTime},</if>
            <if test="status!=null">#{status},</if>
            <if test="callStatus!=null">#{callStatus},</if>
            <if test="sendStatus!=null">#{sendStatus},</if>
            <if test="createUserBo!=null">#{createUserBo},</if>
            <if test="createdDateTime!=null">#{createdDateTime},</if>
            <if test="updateUserBo!=null">#{updateUserBo},</if>
            <if test="updatedDateTime!=null">#{updatedDateTime},</if>
        </trim>
    </insert>

    <insert id="insertAllColumn" parameterType="com.foreverwin.mesnac.dispatch.model.CallItem">
        INSERT INTO Z_CALL_ITEM
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <include refid="Base_Column_List"></include>
        </trim> VALUES
        <trim prefix="(" suffix=")" suffixOverrides=",">
            #{handle},
            #{site},
            #{callItemNo},
            #{shopOrder},
            #{sfc},
            #{dispatchNo},
            #{operation},
            #{stepId},
            #{resrce},
            #{componentBo},
            #{callType},
            #{requiredQty},
            #{requiredDateTime},
            #{status},
            #{callStatus},
            #{sendStatus},
            #{createUserBo},
            #{createdDateTime},
            #{updateUserBo},
            #{updatedDateTime},
        </trim>
    </insert>


    <update id="updateById">
        UPDATE Z_CALL_ITEM <trim prefix="SET" suffixOverrides=",">
        <if test="et.site!=null">SITE=#{et.site},</if>
        <if test="et.callItemNo!=null">CALL_ITEM_NO=#{et.callItemNo},</if>
        <if test="et.shopOrder!=null">SHOP_ORDER=#{et.shopOrder},</if>
        <if test="et.sfc!=null">SFC=#{et.sfc},</if>
        <if test="et.dispatchNo!=null">DISPATCH_NO=#{et.dispatchNo},</if>
        <if test="et.operation!=null">OPERATION=#{et.operation},</if>
        <if test="et.stepId!=null">STEP_ID=#{et.stepId},</if>
        <if test="et.resrce!=null">RESRCE=#{et.resrce},</if>
        <if test="et.componentBo!=null">COMPONENT_BO=#{et.componentBo},</if>
        <if test="et.callType!=null">CALL_TYPE=#{et.callType},</if>
        <if test="et.requiredQty!=null">REQUIRED_QTY=#{et.requiredQty},</if>
        <if test="et.requiredDateTime!=null">REQUIRED_DATE_TIME=#{et.requiredDateTime},</if>
        <if test="et.status!=null">STATUS=#{et.status},</if>
        <if test="et.callStatus!=null">CALL_STATUS=#{et.callStatus},</if>
        <if test="et.sendStatus!=null">SEND_STATUS=#{et.sendStatus},</if>
        <if test="et.createUserBo!=null">CREATE_USER_BO=#{et.createUserBo},</if>
        <if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
        <if test="et.updateUserBo!=null">UPDATE_USER_BO=#{et.updateUserBo},</if>
        <if test="et.updatedDateTime!=null">UPDATED_DATE_TIME=#{et.updatedDateTime},</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_CALL_ITEM <trim prefix="SET" suffixOverrides=",">
        SITE=#{et.site},
        CALL_ITEM_NO=#{et.callItemNo},
        SHOP_ORDER=#{et.shopOrder},
        SFC=#{et.sfc},
        DISPATCH_NO=#{et.dispatchNo},
        OPERATION=#{et.operation},
        STEP_ID=#{et.stepId},
        RESRCE=#{et.resrce},
        COMPONENT_BO=#{et.componentBo},
        CALL_TYPE=#{et.callType},
        REQUIRED_QTY=#{et.requiredQty},
        REQUIRED_DATE_TIME=#{et.requiredDateTime},
        STATUS=#{et.status},
        CALL_STATUS=#{et.callStatus},
        SEND_STATUS=#{et.sendStatus},
        CREATE_USER_BO=#{et.createUserBo},
        CREATED_DATE_TIME=#{et.createdDateTime},
        UPDATE_USER_BO=#{et.updateUserBo},
        UPDATED_DATE_TIME=#{et.updatedDateTime},
     </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_CALL_ITEM <trim prefix="SET" suffixOverrides=",">
        <if test="et.site!=null">SITE=#{et.site},</if>
        <if test="et.callItemNo!=null">CALL_ITEM_NO=#{et.callItemNo},</if>
        <if test="et.shopOrder!=null">SHOP_ORDER=#{et.shopOrder},</if>
        <if test="et.sfc!=null">SFC=#{et.sfc},</if>
        <if test="et.dispatchNo!=null">DISPATCH_NO=#{et.dispatchNo},</if>
        <if test="et.operation!=null">OPERATION=#{et.operation},</if>
        <if test="et.stepId!=null">STEP_ID=#{et.stepId},</if>
        <if test="et.resrce!=null">RESRCE=#{et.resrce},</if>
        <if test="et.componentBo!=null">COMPONENT_BO=#{et.componentBo},</if>
        <if test="et.callType!=null">CALL_TYPE=#{et.callType},</if>
        <if test="et.requiredQty!=null">REQUIRED_QTY=#{et.requiredQty},</if>
        <if test="et.requiredDateTime!=null">REQUIRED_DATE_TIME=#{et.requiredDateTime},</if>
        <if test="et.status!=null">STATUS=#{et.status},</if>
        <if test="et.callStatus!=null">CALL_STATUS=#{et.callStatus},</if>
        <if test="et.sendStatus!=null">SEND_STATUS=#{et.sendStatus},</if>
        <if test="et.createUserBo!=null">CREATE_USER_BO=#{et.createUserBo},</if>
        <if test="et.createdDateTime!=null">CREATED_DATE_TIME=#{et.createdDateTime},</if>
        <if test="et.updateUserBo!=null">UPDATE_USER_BO=#{et.updateUserBo},</if>
        <if test="et.updatedDateTime!=null">UPDATED_DATE_TIME=#{et.updatedDateTime},</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.callItemNo!=null"> AND CALL_ITEM_NO=#{ew.entity.callItemNo}</if>
                    <if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
                    <if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
                    <if test="ew.entity.dispatchNo!=null"> AND DISPATCH_NO=#{ew.entity.dispatchNo}</if>
                    <if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
                    <if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
                    <if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
                    <if test="ew.entity.componentBo!=null"> AND COMPONENT_BO=#{ew.entity.componentBo}</if>
                    <if test="ew.entity.callType!=null"> AND CALL_TYPE=#{ew.entity.callType}</if>
                    <if test="ew.entity.requiredQty!=null"> AND REQUIRED_QTY=#{ew.entity.requiredQty}</if>
                    <if test="ew.entity.requiredDateTime!=null"> AND REQUIRED_DATE_TIME=#{ew.entity.requiredDateTime}</if>
                    <if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
                    <if test="ew.entity.callStatus!=null"> AND CALL_STATUS=#{ew.entity.callStatus}</if>
                    <if test="ew.entity.sendStatus!=null"> AND SEND_STATUS=#{ew.entity.sendStatus}</if>
                    <if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if>
                    <if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</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_CALL_ITEM WHERE HANDLE=#{handle}
    </delete>

    <delete id="deleteByMap">
        DELETE FROM Z_CALL_ITEM
        <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_CALL_ITEM
        <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.callItemNo!=null"> AND CALL_ITEM_NO=#{ew.entity.callItemNo}</if>
                    <if test="ew.entity.shopOrder!=null"> AND SHOP_ORDER=#{ew.entity.shopOrder}</if>
                    <if test="ew.entity.sfc!=null"> AND SFC=#{ew.entity.sfc}</if>
                    <if test="ew.entity.dispatchNo!=null"> AND DISPATCH_NO=#{ew.entity.dispatchNo}</if>
                    <if test="ew.entity.operation!=null"> AND OPERATION=#{ew.entity.operation}</if>
                    <if test="ew.entity.stepId!=null"> AND STEP_ID=#{ew.entity.stepId}</if>
                    <if test="ew.entity.resrce!=null"> AND RESRCE=#{ew.entity.resrce}</if>
                    <if test="ew.entity.componentBo!=null"> AND COMPONENT_BO=#{ew.entity.componentBo}</if>
                    <if test="ew.entity.callType!=null"> AND CALL_TYPE=#{ew.entity.callType}</if>
                    <if test="ew.entity.requiredQty!=null"> AND REQUIRED_QTY=#{ew.entity.requiredQty}</if>
                    <if test="ew.entity.requiredDateTime!=null"> AND REQUIRED_DATE_TIME=#{ew.entity.requiredDateTime}</if>
                    <if test="ew.entity.status!=null"> AND STATUS=#{ew.entity.status}</if>
                    <if test="ew.entity.callStatus!=null"> AND CALL_STATUS=#{ew.entity.callStatus}</if>
                    <if test="ew.entity.sendStatus!=null"> AND SEND_STATUS=#{ew.entity.sendStatus}</if>
                    <if test="ew.entity.createUserBo!=null"> AND CREATE_USER_BO=#{ew.entity.createUserBo}</if>
                    <if test="ew.entity.createdDateTime!=null"> AND CREATED_DATE_TIME=#{ew.entity.createdDateTime}</if>
                    <if test="ew.entity.updateUserBo!=null"> AND UPDATE_USER_BO=#{ew.entity.updateUserBo}</if>
                    <if test="ew.entity.updatedDateTime!=null"> AND UPDATED_DATE_TIME=#{ew.entity.updatedDateTime}</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_CALL_ITEM WHERE HANDLE IN (
        <foreach item="item" index="index" collection="coll" separator=",">#{item}
        </foreach>)
    </delete>
    <!-- BaseMapper标准查询/修改/删除 -->

</mapper>
