<?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.ruoyi.business.mapper.TEbsOrderMapper">
    <resultMap type="TEbsOrder" id="TEbsOrderResult">
        <result property="phaSegment1" column="phaSegment1" />
        <result property="shipmentNum" column="shipmentNum" />
        <result property="distributionNum" column="distributionNum" />
        <result property="supplyTypeCode" column="supplyTypeCode" />
        <result property="msQuantity" column="msQuantity" />
        <result property="poDistributionId" column="poDistributionId" />
        <result property="poHeaderId" column="poHeaderId" />
        <result property="poLineId" column="poLineId" />
        <result property="lineNum" column="lineNum" />
        <result property="orgId" column="orgId" />
        <result property="shipToOrganizationId" column="shipToOrganizationId" />
        <result property="itemId" column="itemId" />
        <result property="itemDescription" column="itemDescription" />
        <result property="unitMeasLookupCode" column="unitMeasLookupCode" />
        <result property="unitPrice" column="unitPrice" />
        <result property="quantity" column="quantity" />
        <result property="quantityReceived" column="quantityReceived" />
        <result property="closedCode" column="closedCode" />
        <result property="lineLocationId" column="lineLocationId" />
        <result property="vendorId" column="vendorId" />
        <result property="vendorName" column="vendorName" />
        <result property="wipEntityId" column="wipEntityId" />
        <result property="receivingRoutingId" column="receivingRoutingId" />
        <result property="lotControl" column="lotControl" />
        <result property="checkPriority" column="checkPriority" />
    </resultMap>

    <sql id="selectTEbsOrderALl">
        select * from t_ebs_order
    </sql>

    <select id="selectTEbsOrderList" parameterType="TEbsOrder" resultMap="TEbsOrderResult">
        <include refid="selectTEbsOrderALl"/>
        <where>
            <if test="phaSegment1 != null and phaSegment1 != ''"> and phaSegment1 = #{phaSegment1}</if>
            <if test="itemId != null"> and itemId = #{itemId}</if>
        </where>
    </select>

    <insert id="insertTEbsOrder" parameterType="TEbsOrder">
        insert into t_ebs_order
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="phaSegment1 != null">phaSegment1,</if>
            <if test="shipmentNum != null">shipmentNum,</if>
            <if test="distributionNum != null">distributionNum,</if>
            <if test="supplyTypeCode != null">supplyTypeCode,</if>
            <if test="msQuantity != null">msQuantity,</if>
            <if test="poDistributionId != null">poDistributionId,</if>
            <if test="poHeaderId != null">poHeaderId,</if>
            <if test="poLineId != null">poLineId,</if>
            <if test="lineNum != null">lineNum,</if>
            <if test="orgId != null">orgId,</if>
            <if test="shipToOrganizationId != null">shipToOrganizationId,</if>
            <if test="itemId != null">itemId,</if>
            <if test="itemDescription != null">itemDescription,</if>
            <if test="unitMeasLookupCode != null">unitMeasLookupCode,</if>
            <if test="unitPrice != null">unitPrice,</if>
            <if test="quantity != null">quantity,</if>
            <if test="quantityReceived != null">quantityReceived,</if>
            <if test="closedCode != null">closedCode,</if>
            <if test="lineLocationId != null">lineLocationId,</if>
            <if test="vendorId != null">vendorId,</if>
            <if test="vendorName != null">vendorName,</if>
            <if test="wipEntityId != null">wipEntityId,</if>
            <if test="receivingRoutingId != null">receivingRoutingId,</if>
            <if test="lotControl != null">lotControl,</if>
            <if test="checkPriority != null">checkPriority,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="phaSegment1 != null">#{phaSegment1},</if>
            <if test="shipmentNum != null">#{shipmentNum},</if>
            <if test="distributionNum != null">#{distributionNum},</if>
            <if test="supplyTypeCode != null">#{supplyTypeCode},</if>
            <if test="msQuantity != null">#{msQuantity},</if>
            <if test="poDistributionId != null">#{poDistributionId},</if>
            <if test="poHeaderId != null">#{poHeaderId},</if>
            <if test="poLineId != null">#{poLineId},</if>
            <if test="lineNum != null">#{lineNum},</if>
            <if test="orgId != null">#{orgId},</if>
            <if test="shipToOrganizationId != null">#{shipToOrganizationId},</if>
            <if test="itemId != null">#{itemId},</if>
            <if test="itemDescription != null">#{itemDescription},</if>
            <if test="unitMeasLookupCode != null">#{unitMeasLookupCode},</if>
            <if test="unitPrice != null">#{unitPrice},</if>
            <if test="quantity != null">#{quantity},</if>
            <if test="quantityReceived != null">#{quantityReceived},</if>
            <if test="closedCode != null">#{closedCode},</if>
            <if test="lineLocationId != null">#{lineLocationId},</if>
            <if test="vendorId != null">#{vendorId},</if>
            <if test="vendorName != null">#{vendorName},</if>
            <if test="wipEntityId != null">#{wipEntityId},</if>
            <if test="receivingRoutingId != null">#{receivingRoutingId},</if>
            <if test="lotControl != null">#{lotControl},</if>
            <if test="checkPriority != null">#{checkPriority},</if>
        </trim>
    </insert>

    <update id="updateTEbsOrder" parameterType="TEbsOrder">
        update t_ebs_order
        <trim prefix="SET" suffixOverrides=",">
            <if test="shipmentNum != null">shipmentNum = #{shipmentNum},</if>
            <if test="distributionNum != null">distributionNum = #{distributionNum},</if>
            <if test="supplyTypeCode != null">supplyTypeCode = #{supplyTypeCode},</if>
            <if test="msQuantity != null">msQuantity = #{msQuantity},</if>
            <if test="poDistributionId != null">poDistributionId = #{poDistributionId},</if>
            <if test="poHeaderId != null">poHeaderId = #{poHeaderId},</if>
            <if test="poLineId != null">poLineId = #{poLineId},</if>
            <if test="lineNum != null">lineNum = #{lineNum},</if>
            <if test="orgId != null">orgId = #{orgId},</if>
            <if test="shipToOrganizationId != null">shipToOrganizationId = #{shipToOrganizationId},</if>
            <if test="itemDescription != null">itemDescription = #{itemDescription},</if>
            <if test="unitMeasLookupCode != null">unitMeasLookupCode = #{unitMeasLookupCode},</if>
            <if test="unitPrice != null">unitPrice = #{unitPrice},</if>
            <if test="quantity != null">quantity = #{quantity},</if>
            <if test="quantityReceived != null">quantityReceived = #{quantityReceived},</if>
            <if test="closedCode != null">closedCode = #{closedCode},</if>
            <if test="lineLocationId != null">lineLocationId = #{lineLocationId},</if>
            <if test="vendorId != null">vendorId = #{vendorId},</if>
            <if test="vendorName != null">vendorName = #{vendorName},</if>
            <if test="wipEntityId != null">wipEntityId = #{wipEntityId},</if>
            <if test="receivingRoutingId != null">receivingRoutingId = #{receivingRoutingId},</if>
            <if test="lotControl != null">lotControl = #{lotControl},</if>
            <if test="checkPriority != null">checkPriority = #{checkPriority},</if>
        </trim>
        where phaSegment1 = #{phaSegment1} and itemId = #{itemId}
    </update>

    <delete id="deleteTEbsOrder" parameterType="TEbsOrder">
        delete from t_ebs_order where phaSegment1 = #{phaSegment1} and itemId = #{itemId}
    </delete>
</mapper>