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

    <select id="selectSKcKnClyhStoremaintenancesheetList" parameterType="pd" resultType="pd">
        select * from s_kc_kn_clyh_storemaintenancesheet where 1=1
        <if test="storeName !=null and storeName !='' ">
            and storeName = #{storeName}
        </if>
        <if test="maintenanceSheetNumber !=null and maintenanceSheetNumber !='' ">
            and maintenanceSheetNumber = #{maintenanceSheetNumber}
        </if>
        <if test="type !=null and type !='' ">
            and type = #{type}
        </if>
        <if test="plannedMaintenanceTime !=null and plannedMaintenanceTime !='' ">
            and plannedMaintenanceTime = #{plannedMaintenanceTime}
        </if>
        <if test="actualMaintenanceTime !=null and actualMaintenanceTime !='' ">
            and actualMaintenanceTime = #{actualMaintenanceTime}
        </if>
        <if test="status !=null and status !='' ">
            and status = #{status}
        </if>
    </select>


    <update id="updateSKcKnClyhStoremaintenancesheet" parameterType="pd" >
        update s_kc_kn_clyh_storemaintenancesheet
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="storeName !=null and storeName !='' ">
            storeName = #{storeName},
        </if>
        <if test="maintenanceSheetNumber !=null and maintenanceSheetNumber !='' ">
            maintenanceSheetNumber = #{maintenanceSheetNumber},
        </if>
        <if test="type !=null and type !='' ">
            type = #{type},
        </if>
        <if test="plannedMaintenanceTime !=null and plannedMaintenanceTime !='' ">
            plannedMaintenanceTime = #{plannedMaintenanceTime},
        </if>
        <if test="actualMaintenanceTime !=null and actualMaintenanceTime !='' ">
            actualMaintenanceTime = #{actualMaintenanceTime},
        </if>
        <if test="status !=null and status !='' ">
            status = #{status},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="storeName !=null and storeName !='' ">
            storeName,
        </if>
        <if test="maintenanceSheetNumber !=null and maintenanceSheetNumber !='' ">
            maintenanceSheetNumber,
        </if>
        <if test="type !=null and type !='' ">
            type,
        </if>
        <if test="plannedMaintenanceTime !=null and plannedMaintenanceTime !='' ">
            plannedMaintenanceTime,
        </if>
        <if test="actualMaintenanceTime !=null and actualMaintenanceTime !='' ">
            actualMaintenanceTime,
        </if>
        <if test="status !=null and status !='' ">
            status,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="storeName !=null and storeName !='' ">
             #{storeName},
        </if>
        <if test="maintenanceSheetNumber !=null and maintenanceSheetNumber !='' ">
             #{maintenanceSheetNumber},
        </if>
        <if test="type !=null and type !='' ">
             #{type},
        </if>
        <if test="plannedMaintenanceTime !=null and plannedMaintenanceTime !='' ">
             #{plannedMaintenanceTime},
        </if>
        <if test="actualMaintenanceTime !=null and actualMaintenanceTime !='' ">
             #{actualMaintenanceTime},
        </if>
        <if test="status !=null and status !='' ">
             #{status},
        </if>
        </trim>

    </insert>

</mapper>
