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

    <select id="selectSBbfxKcbbJgkcmxList" parameterType="pd" resultType="pd">
        select * from s_bbfx_kcbb_jgkcmx where 1=1
        <if test="id !=null and id !='' ">
            and id = #{id}
        </if>
        <if test="organizationId !=null and organizationId !='' ">
            and organizationId = #{organizationId}
        </if>
        <if test="productId !=null and productId !='' ">
            and productId = #{productId}
        </if>
        <if test="productName !=null and productName !='' ">
            and productName = #{productName}
        </if>
        <if test="productCode !=null and productCode !='' ">
            and productCode = #{productCode}
        </if>
        <if test="category !=null and category !='' ">
            and category = #{category}
        </if>
        <if test="supplier !=null and supplier !='' ">
            and supplier = #{supplier}
        </if>
        <if test="stockQuantity !=null and stockQuantity !='' ">
            and stockQuantity = #{stockQuantity}
        </if>
        <if test="reorderLevel !=null and reorderLevel !='' ">
            and reorderLevel = #{reorderLevel}
        </if>
        <if test="lastStockCheckTime !=null and lastStockCheckTime !='' ">
            and lastStockCheckTime = #{lastStockCheckTime}
        </if>
        <if test="lastEditor !=null and lastEditor !='' ">
            and lastEditor = #{lastEditor}
        </if>
        <if test="lastEditTime !=null and lastEditTime !='' ">
            and lastEditTime = #{lastEditTime}
        </if>
    </select>


    <update id="updateSBbfxKcbbJgkcmx" parameterType="pd" >
        update s_bbfx_kcbb_jgkcmx
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="organizationId !=null and organizationId !='' ">
            organizationId = #{organizationId},
        </if>
        <if test="productId !=null and productId !='' ">
            productId = #{productId},
        </if>
        <if test="productName !=null and productName !='' ">
            productName = #{productName},
        </if>
        <if test="productCode !=null and productCode !='' ">
            productCode = #{productCode},
        </if>
        <if test="category !=null and category !='' ">
            category = #{category},
        </if>
        <if test="supplier !=null and supplier !='' ">
            supplier = #{supplier},
        </if>
        <if test="stockQuantity !=null and stockQuantity !='' ">
            stockQuantity = #{stockQuantity},
        </if>
        <if test="reorderLevel !=null and reorderLevel !='' ">
            reorderLevel = #{reorderLevel},
        </if>
        <if test="lastStockCheckTime !=null and lastStockCheckTime !='' ">
            lastStockCheckTime = #{lastStockCheckTime},
        </if>
        <if test="lastEditor !=null and lastEditor !='' ">
            lastEditor = #{lastEditor},
        </if>
        <if test="lastEditTime !=null and lastEditTime !='' ">
            lastEditTime = #{lastEditTime},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="organizationId !=null and organizationId !='' ">
            organizationId,
        </if>
        <if test="productId !=null and productId !='' ">
            productId,
        </if>
        <if test="productName !=null and productName !='' ">
            productName,
        </if>
        <if test="productCode !=null and productCode !='' ">
            productCode,
        </if>
        <if test="category !=null and category !='' ">
            category,
        </if>
        <if test="supplier !=null and supplier !='' ">
            supplier,
        </if>
        <if test="stockQuantity !=null and stockQuantity !='' ">
            stockQuantity,
        </if>
        <if test="reorderLevel !=null and reorderLevel !='' ">
            reorderLevel,
        </if>
        <if test="lastStockCheckTime !=null and lastStockCheckTime !='' ">
            lastStockCheckTime,
        </if>
        <if test="lastEditor !=null and lastEditor !='' ">
            lastEditor,
        </if>
        <if test="lastEditTime !=null and lastEditTime !='' ">
            lastEditTime,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="organizationId !=null and organizationId !='' ">
             #{organizationId},
        </if>
        <if test="productId !=null and productId !='' ">
             #{productId},
        </if>
        <if test="productName !=null and productName !='' ">
             #{productName},
        </if>
        <if test="productCode !=null and productCode !='' ">
             #{productCode},
        </if>
        <if test="category !=null and category !='' ">
             #{category},
        </if>
        <if test="supplier !=null and supplier !='' ">
             #{supplier},
        </if>
        <if test="stockQuantity !=null and stockQuantity !='' ">
             #{stockQuantity},
        </if>
        <if test="reorderLevel !=null and reorderLevel !='' ">
             #{reorderLevel},
        </if>
        <if test="lastStockCheckTime !=null and lastStockCheckTime !='' ">
             #{lastStockCheckTime},
        </if>
        <if test="lastEditor !=null and lastEditor !='' ">
             #{lastEditor},
        </if>
        <if test="lastEditTime !=null and lastEditTime !='' ">
             #{lastEditTime},
        </if>
        </trim>

    </insert>

</mapper>
