<?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="SKcCrkMdqhdRequisitionorderMapper" >
    <!-- 通用查询映射结果 -->

    <select id="selectSKcCrkMdqhdRequisitionorderList" parameterType="pd" resultType="pd">
        select * from s_kc_crk_mdqhd_requisitionorder where 1=1
        <if test="requisitionOrderNumber !=null and requisitionOrderNumber !='' ">
            and requisitionOrderNumber = #{requisitionOrderNumber}
        </if>
        <if test="requisitionOrderType !=null and requisitionOrderType !='' ">
            and requisitionOrderType = #{requisitionOrderType}
        </if>
        <if test="generationTime !=null and generationTime !='' ">
            and generationTime = #{generationTime}
        </if>
        <if test="itemQuantity !=null and itemQuantity !='' ">
            and itemQuantity = #{itemQuantity}
        </if>
        <if test="requisitionOrderStatus !=null and requisitionOrderStatus !='' ">
            and requisitionOrderStatus = #{requisitionOrderStatus}
        </if>
    </select>


    <update id="updateSKcCrkMdqhdRequisitionorder" parameterType="pd" >
        update s_kc_crk_mdqhd_requisitionorder
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="requisitionOrderNumber !=null and requisitionOrderNumber !='' ">
            requisitionOrderNumber = #{requisitionOrderNumber},
        </if>
        <if test="requisitionOrderType !=null and requisitionOrderType !='' ">
            requisitionOrderType = #{requisitionOrderType},
        </if>
        <if test="generationTime !=null and generationTime !='' ">
            generationTime = #{generationTime},
        </if>
        <if test="itemQuantity !=null and itemQuantity !='' ">
            itemQuantity = #{itemQuantity},
        </if>
        <if test="requisitionOrderStatus !=null and requisitionOrderStatus !='' ">
            requisitionOrderStatus = #{requisitionOrderStatus},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

    <delete id="SKcCrkMdqhdRequisitionorderRemove" parameterType="pd">
        <if test="ids != null">
            delete from s_kc_crk_mdqhd_requisitionorder where
            <if test="ids != null">
                id in(${ids})
            </if>
        </if>
    </delete>

    <insert id="addSKcCrkMdqhdRequisitionorder" parameterType="pd" >

        insert into s_kc_crk_mdqhd_requisitionorder
        <trim prefix="(" suffix=")" prefixOverrides="," suffixOverrides=",">

        <if test="requisitionOrderNumber !=null and requisitionOrderNumber !='' ">
            requisitionOrderNumber,
        </if>
        <if test="requisitionOrderType !=null and requisitionOrderType !='' ">
            requisitionOrderType,
        </if>
        <if test="generationTime !=null and generationTime !='' ">
            generationTime,
        </if>
        <if test="itemQuantity !=null and itemQuantity !='' ">
            itemQuantity,
        </if>
        <if test="requisitionOrderStatus !=null and requisitionOrderStatus !='' ">
            requisitionOrderStatus,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="requisitionOrderNumber !=null and requisitionOrderNumber !='' ">
             #{requisitionOrderNumber},
        </if>
        <if test="requisitionOrderType !=null and requisitionOrderType !='' ">
             #{requisitionOrderType},
        </if>
        <if test="generationTime !=null and generationTime !='' ">
             #{generationTime},
        </if>
        <if test="itemQuantity !=null and itemQuantity !='' ">
             #{itemQuantity},
        </if>
        <if test="requisitionOrderStatus !=null and requisitionOrderStatus !='' ">
             #{requisitionOrderStatus},
        </if>
        </trim>

    </insert>

</mapper>
