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

    <select id="selectSKcBbMaintenanceorderitemsList" parameterType="pd" resultType="pd">
        select * from s_kc_bb_maintenanceorderitems where 1=1
        <if test="maintenanceLevel !=null and maintenanceLevel !='' ">
            and maintenanceLevel = #{maintenanceLevel}
        </if>
        <if test="productCode !=null and productCode !='' ">
            and productCode = #{productCode}
        </if>
        <if test="productName !=null and productName !='' ">
            and productName = #{productName}
        </if>
        <if test="maintenanceOrderNumber !=null and maintenanceOrderNumber !='' ">
            and maintenanceOrderNumber = #{maintenanceOrderNumber}
        </if>
        <if test="specification !=null and specification !='' ">
            and specification = #{specification}
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            and manufacturer = #{manufacturer}
        </if>
        <if test="batchNumber !=null and batchNumber !='' ">
            and batchNumber = #{batchNumber}
        </if>
        <if test="productionDate !=null and productionDate !='' ">
            and productionDate = #{productionDate}
        </if>
        <if test="expiryDate !=null and expiryDate !='' ">
            and expiryDate = #{expiryDate}
        </if>
        <if test="inventoryQuantity !=null and inventoryQuantity !='' ">
            and inventoryQuantity = #{inventoryQuantity}
        </if>
        <if test="inspectionQuantity !=null and inspectionQuantity !='' ">
            and inspectionQuantity = #{inspectionQuantity}
        </if>
        <if test="qualifiedQuantity !=null and qualifiedQuantity !='' ">
            and qualifiedQuantity = #{qualifiedQuantity}
        </if>
        <if test="unqualifiedQuantity !=null and unqualifiedQuantity !='' ">
            and unqualifiedQuantity = #{unqualifiedQuantity}
        </if>
        <if test="conclusion !=null and conclusion !='' ">
            and conclusion = #{conclusion}
        </if>
        <if test="handlingMeasures !=null and handlingMeasures !='' ">
            and handlingMeasures = #{handlingMeasures}
        </if>
        <if test="inspectionDate !=null and inspectionDate !='' ">
            and inspectionDate = #{inspectionDate}
        </if>
        <if test="inspector !=null and inspector !='' ">
            and inspector = #{inspector}
        </if>
        <if test="maintainer !=null and maintainer !='' ">
            and maintainer = #{maintainer}
        </if>
    </select>


    <update id="updateSKcBbMaintenanceorderitems" parameterType="pd" >
        update s_kc_bb_maintenanceorderitems
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="maintenanceLevel !=null and maintenanceLevel !='' ">
            maintenanceLevel = #{maintenanceLevel},
        </if>
        <if test="productCode !=null and productCode !='' ">
            productCode = #{productCode},
        </if>
        <if test="productName !=null and productName !='' ">
            productName = #{productName},
        </if>
        <if test="maintenanceOrderNumber !=null and maintenanceOrderNumber !='' ">
            maintenanceOrderNumber = #{maintenanceOrderNumber},
        </if>
        <if test="specification !=null and specification !='' ">
            specification = #{specification},
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            manufacturer = #{manufacturer},
        </if>
        <if test="batchNumber !=null and batchNumber !='' ">
            batchNumber = #{batchNumber},
        </if>
        <if test="productionDate !=null and productionDate !='' ">
            productionDate = #{productionDate},
        </if>
        <if test="expiryDate !=null and expiryDate !='' ">
            expiryDate = #{expiryDate},
        </if>
        <if test="inventoryQuantity !=null and inventoryQuantity !='' ">
            inventoryQuantity = #{inventoryQuantity},
        </if>
        <if test="inspectionQuantity !=null and inspectionQuantity !='' ">
            inspectionQuantity = #{inspectionQuantity},
        </if>
        <if test="qualifiedQuantity !=null and qualifiedQuantity !='' ">
            qualifiedQuantity = #{qualifiedQuantity},
        </if>
        <if test="unqualifiedQuantity !=null and unqualifiedQuantity !='' ">
            unqualifiedQuantity = #{unqualifiedQuantity},
        </if>
        <if test="conclusion !=null and conclusion !='' ">
            conclusion = #{conclusion},
        </if>
        <if test="handlingMeasures !=null and handlingMeasures !='' ">
            handlingMeasures = #{handlingMeasures},
        </if>
        <if test="inspectionDate !=null and inspectionDate !='' ">
            inspectionDate = #{inspectionDate},
        </if>
        <if test="inspector !=null and inspector !='' ">
            inspector = #{inspector},
        </if>
        <if test="maintainer !=null and maintainer !='' ">
            maintainer = #{maintainer},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="maintenanceLevel !=null and maintenanceLevel !='' ">
            maintenanceLevel,
        </if>
        <if test="productCode !=null and productCode !='' ">
            productCode,
        </if>
        <if test="productName !=null and productName !='' ">
            productName,
        </if>
        <if test="maintenanceOrderNumber !=null and maintenanceOrderNumber !='' ">
            maintenanceOrderNumber,
        </if>
        <if test="specification !=null and specification !='' ">
            specification,
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
            manufacturer,
        </if>
        <if test="batchNumber !=null and batchNumber !='' ">
            batchNumber,
        </if>
        <if test="productionDate !=null and productionDate !='' ">
            productionDate,
        </if>
        <if test="expiryDate !=null and expiryDate !='' ">
            expiryDate,
        </if>
        <if test="inventoryQuantity !=null and inventoryQuantity !='' ">
            inventoryQuantity,
        </if>
        <if test="inspectionQuantity !=null and inspectionQuantity !='' ">
            inspectionQuantity,
        </if>
        <if test="qualifiedQuantity !=null and qualifiedQuantity !='' ">
            qualifiedQuantity,
        </if>
        <if test="unqualifiedQuantity !=null and unqualifiedQuantity !='' ">
            unqualifiedQuantity,
        </if>
        <if test="conclusion !=null and conclusion !='' ">
            conclusion,
        </if>
        <if test="handlingMeasures !=null and handlingMeasures !='' ">
            handlingMeasures,
        </if>
        <if test="inspectionDate !=null and inspectionDate !='' ">
            inspectionDate,
        </if>
        <if test="inspector !=null and inspector !='' ">
            inspector,
        </if>
        <if test="maintainer !=null and maintainer !='' ">
            maintainer,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="maintenanceLevel !=null and maintenanceLevel !='' ">
             #{maintenanceLevel},
        </if>
        <if test="productCode !=null and productCode !='' ">
             #{productCode},
        </if>
        <if test="productName !=null and productName !='' ">
             #{productName},
        </if>
        <if test="maintenanceOrderNumber !=null and maintenanceOrderNumber !='' ">
             #{maintenanceOrderNumber},
        </if>
        <if test="specification !=null and specification !='' ">
             #{specification},
        </if>
        <if test="manufacturer !=null and manufacturer !='' ">
             #{manufacturer},
        </if>
        <if test="batchNumber !=null and batchNumber !='' ">
             #{batchNumber},
        </if>
        <if test="productionDate !=null and productionDate !='' ">
             #{productionDate},
        </if>
        <if test="expiryDate !=null and expiryDate !='' ">
             #{expiryDate},
        </if>
        <if test="inventoryQuantity !=null and inventoryQuantity !='' ">
             #{inventoryQuantity},
        </if>
        <if test="inspectionQuantity !=null and inspectionQuantity !='' ">
             #{inspectionQuantity},
        </if>
        <if test="qualifiedQuantity !=null and qualifiedQuantity !='' ">
             #{qualifiedQuantity},
        </if>
        <if test="unqualifiedQuantity !=null and unqualifiedQuantity !='' ">
             #{unqualifiedQuantity},
        </if>
        <if test="conclusion !=null and conclusion !='' ">
             #{conclusion},
        </if>
        <if test="handlingMeasures !=null and handlingMeasures !='' ">
             #{handlingMeasures},
        </if>
        <if test="inspectionDate !=null and inspectionDate !='' ">
             #{inspectionDate},
        </if>
        <if test="inspector !=null and inspector !='' ">
             #{inspector},
        </if>
        <if test="maintainer !=null and maintainer !='' ">
             #{maintainer},
        </if>
        </trim>

    </insert>

</mapper>
