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

    <select id="selectSKcBbQualityreportitemsList" parameterType="pd" resultType="pd">
        select * from s_kc_bb_qualityreportitems where 1=1
        <if test="productCode !=null and productCode !='' ">
            and productCode = #{productCode}
        </if>
        <if test="productName !=null and productName !='' ">
            and productName = #{productName}
        </if>
        <if test="reportDocumentNumber !=null and reportDocumentNumber !='' ">
            and reportDocumentNumber = #{reportDocumentNumber}
        </if>
        <if test="specification !=null and specification !='' ">
            and specification = #{specification}
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            and manufacturer = #{manufacturer}
        </if>
        <if test="productionBatchNumber !=null and productionBatchNumber !='' ">
            and productionBatchNumber = #{productionBatchNumber}
        </if>
        <if test="reportDate !=null and reportDate !='' ">
            and reportDate = #{reportDate}
        </if>
        <if test="productionDate !=null and productionDate !='' ">
            and productionDate = #{productionDate}
        </if>
        <if test="expirationDate !=null and expirationDate !='' ">
            and expirationDate = #{expirationDate}
        </if>
        <if test="quantity !=null and quantity !='' ">
            and quantity = #{quantity}
        </if>
        <if test="unit !=null and unit !='' ">
            and unit = #{unit}
        </if>
        <if test="reason !=null and reason !='' ">
            and reason = #{reason}
        </if>
        <if test="conclusion !=null and conclusion !='' ">
            and conclusion = #{conclusion}
        </if>
        <if test="handlingMeasures !=null and handlingMeasures !='' ">
            and handlingMeasures = #{handlingMeasures}
        </if>
        <if test="reporter !=null and reporter !='' ">
            and reporter = #{reporter}
        </if>
    </select>


    <update id="updateSKcBbQualityreportitems" parameterType="pd" >
        update s_kc_bb_qualityreportitems
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="productCode !=null and productCode !='' ">
            productCode = #{productCode},
        </if>
        <if test="productName !=null and productName !='' ">
            productName = #{productName},
        </if>
        <if test="reportDocumentNumber !=null and reportDocumentNumber !='' ">
            reportDocumentNumber = #{reportDocumentNumber},
        </if>
        <if test="specification !=null and specification !='' ">
            specification = #{specification},
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            manufacturer = #{manufacturer},
        </if>
        <if test="productionBatchNumber !=null and productionBatchNumber !='' ">
            productionBatchNumber = #{productionBatchNumber},
        </if>
        <if test="reportDate !=null and reportDate !='' ">
            reportDate = #{reportDate},
        </if>
        <if test="productionDate !=null and productionDate !='' ">
            productionDate = #{productionDate},
        </if>
        <if test="expirationDate !=null and expirationDate !='' ">
            expirationDate = #{expirationDate},
        </if>
        <if test="quantity !=null and quantity !='' ">
            quantity = #{quantity},
        </if>
        <if test="unit !=null and unit !='' ">
            unit = #{unit},
        </if>
        <if test="reason !=null and reason !='' ">
            reason = #{reason},
        </if>
        <if test="conclusion !=null and conclusion !='' ">
            conclusion = #{conclusion},
        </if>
        <if test="handlingMeasures !=null and handlingMeasures !='' ">
            handlingMeasures = #{handlingMeasures},
        </if>
        <if test="reporter !=null and reporter !='' ">
            reporter = #{reporter},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="productCode !=null and productCode !='' ">
            productCode,
        </if>
        <if test="productName !=null and productName !='' ">
            productName,
        </if>
        <if test="reportDocumentNumber !=null and reportDocumentNumber !='' ">
            reportDocumentNumber,
        </if>
        <if test="specification !=null and specification !='' ">
            specification,
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            manufacturer,
        </if>
        <if test="productionBatchNumber !=null and productionBatchNumber !='' ">
            productionBatchNumber,
        </if>
        <if test="reportDate !=null and reportDate !='' ">
            reportDate,
        </if>
        <if test="productionDate !=null and productionDate !='' ">
            productionDate,
        </if>
        <if test="expirationDate !=null and expirationDate !='' ">
            expirationDate,
        </if>
        <if test="quantity !=null and quantity !='' ">
            quantity,
        </if>
        <if test="unit !=null and unit !='' ">
            unit,
        </if>
        <if test="reason !=null and reason !='' ">
            reason,
        </if>
        <if test="conclusion !=null and conclusion !='' ">
            conclusion,
        </if>
        <if test="handlingMeasures !=null and handlingMeasures !='' ">
            handlingMeasures,
        </if>
        <if test="reporter !=null and reporter !='' ">
            reporter,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="productCode !=null and productCode !='' ">
             #{productCode},
        </if>
        <if test="productName !=null and productName !='' ">
             #{productName},
        </if>
        <if test="reportDocumentNumber !=null and reportDocumentNumber !='' ">
             #{reportDocumentNumber},
        </if>
        <if test="specification !=null and specification !='' ">
             #{specification},
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
             #{manufacturer},
        </if>
        <if test="productionBatchNumber !=null and productionBatchNumber !='' ">
             #{productionBatchNumber},
        </if>
        <if test="reportDate !=null and reportDate !='' ">
             #{reportDate},
        </if>
        <if test="productionDate !=null and productionDate !='' ">
             #{productionDate},
        </if>
        <if test="expirationDate !=null and expirationDate !='' ">
             #{expirationDate},
        </if>
        <if test="quantity !=null and quantity !='' ">
             #{quantity},
        </if>
        <if test="unit !=null and unit !='' ">
             #{unit},
        </if>
        <if test="reason !=null and reason !='' ">
             #{reason},
        </if>
        <if test="conclusion !=null and conclusion !='' ">
             #{conclusion},
        </if>
        <if test="handlingMeasures !=null and handlingMeasures !='' ">
             #{handlingMeasures},
        </if>
        <if test="reporter !=null and reporter !='' ">
             #{reporter},
        </if>
        </trim>

    </insert>

</mapper>
