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

    <select id="selectSKcKnStoragelocationList" parameterType="pd" resultType="pd">
        select * from s_kc_kn_storagelocation where 1=1
        <if test="qualityArea !=null and qualityArea !='' ">
            and qualityArea = #{qualityArea}
        </if>
        <if test="type !=null and type !='' ">
            and type = #{type}
        </if>
        <if test="code !=null and code !='' ">
            and code = #{code}
        </if>
        <if test="dimensions !=null and dimensions !='' ">
            and dimensions = #{dimensions}
        </if>
        <if test="remarks !=null and remarks !='' ">
            and remarks = #{remarks}
        </if>
        <if test="defaultStatus !=null and defaultStatus !='' ">
            and defaultStatus = #{defaultStatus}
        </if>
        <if test="locationStatus !=null and locationStatus !='' ">
            and locationStatus = #{locationStatus}
        </if>
    </select>


    <update id="updateSKcKnStoragelocation" parameterType="pd" >
        update s_kc_kn_storagelocation
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="qualityArea !=null and qualityArea !='' ">
            qualityArea = #{qualityArea},
        </if>
        <if test="type !=null and type !='' ">
            type = #{type},
        </if>
        <if test="code !=null and code !='' ">
            code = #{code},
        </if>
        <if test="dimensions !=null and dimensions !='' ">
            dimensions = #{dimensions},
        </if>
        <if test="remarks !=null and remarks !='' ">
            remarks = #{remarks},
        </if>
        <if test="defaultStatus !=null and defaultStatus !='' ">
            defaultStatus = #{defaultStatus},
        </if>
        <if test="locationStatus !=null and locationStatus !='' ">
            locationStatus = #{locationStatus},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="qualityArea !=null and qualityArea !='' ">
            qualityArea,
        </if>
        <if test="type !=null and type !='' ">
            type,
        </if>
        <if test="code !=null and code !='' ">
            code,
        </if>
        <if test="dimensions !=null and dimensions !='' ">
            dimensions,
        </if>
        <if test="remarks !=null and remarks !='' ">
            remarks,
        </if>
        <if test="defaultStatus !=null and defaultStatus !='' ">
            defaultStatus,
        </if>
        <if test="locationStatus !=null and locationStatus !='' ">
            locationStatus,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="qualityArea !=null and qualityArea !='' ">
             #{qualityArea},
        </if>
        <if test="type !=null and type !='' ">
             #{type},
        </if>
        <if test="code !=null and code !='' ">
             #{code},
        </if>
        <if test="dimensions !=null and dimensions !='' ">
             #{dimensions},
        </if>
        <if test="remarks !=null and remarks !='' ">
             #{remarks},
        </if>
        <if test="defaultStatus !=null and defaultStatus !='' ">
             #{defaultStatus},
        </if>
        <if test="locationStatus !=null and locationStatus !='' ">
             #{locationStatus},
        </if>
        </trim>

    </insert>

</mapper>
