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

    <select id="selectSSpglJfspProductinfoList" parameterType="pd" resultType="pd">
        select * from s_spgl_jfsp_productinfo where 1=1
        <if test="productName !=null and productName !='' ">
            and productName = #{productName}
        </if>
        <if test="productImage !=null and productImage !='' ">
            and productImage = #{productImage}
        </if>
        <if test="salesPrice !=null and salesPrice !='' ">
            and salesPrice = #{salesPrice}
        </if>
        <if test="exchangePrice !=null and exchangePrice !='' ">
            and exchangePrice = #{exchangePrice}
        </if>
        <if test="stock !=null and stock !='' ">
            and stock = #{stock}
        </if>
        <if test="createTime !=null and createTime !='' ">
            and createTime = #{createTime}
        </if>
        <if test="productType !=null and productType !='' ">
            and productType = #{productType}
        </if>
        <if test="salesStatus !=null and salesStatus !='' ">
            and salesStatus = #{salesStatus}
        </if>
        <if test="foregroundCategory !=null and foregroundCategory !='' ">
            and foregroundCategory = #{foregroundCategory}
        </if>
    </select>


    <update id="updateSSpglJfspProductinfo" parameterType="pd" >
        update s_spgl_jfsp_productinfo
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="productName !=null and productName !='' ">
            productName = #{productName},
        </if>
        <if test="productImage !=null and productImage !='' ">
            productImage = #{productImage},
        </if>
        <if test="salesPrice !=null and salesPrice !='' ">
            salesPrice = #{salesPrice},
        </if>
        <if test="exchangePrice !=null and exchangePrice !='' ">
            exchangePrice = #{exchangePrice},
        </if>
        <if test="stock !=null and stock !='' ">
            stock = #{stock},
        </if>
        <if test="createTime !=null and createTime !='' ">
            createTime = #{createTime},
        </if>
        <if test="productType !=null and productType !='' ">
            productType = #{productType},
        </if>
        <if test="salesStatus !=null and salesStatus !='' ">
            salesStatus = #{salesStatus},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="productName !=null and productName !='' ">
            productName,
        </if>
        <if test="productImage !=null and productImage !='' ">
            productImage,
        </if>
        <if test="salesPrice !=null and salesPrice !='' ">
            salesPrice,
        </if>
        <if test="exchangePrice !=null and exchangePrice !='' ">
            exchangePrice,
        </if>
        <if test="stock !=null and stock !='' ">
            stock,
        </if>
        <if test="createTime !=null and createTime !='' ">
            createTime,
        </if>
        <if test="productType !=null and productType !='' ">
            productType,
        </if>
        <if test="salesStatus !=null and salesStatus !='' ">
            salesStatus,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="productName !=null and productName !='' ">
             #{productName},
        </if>
        <if test="productImage !=null and productImage !='' ">
             #{productImage},
        </if>
        <if test="salesPrice !=null and salesPrice !='' ">
             #{salesPrice},
        </if>
        <if test="exchangePrice !=null and exchangePrice !='' ">
             #{exchangePrice},
        </if>
        <if test="stock !=null and stock !='' ">
             #{stock},
        </if>
        <if test="createTime !=null and createTime !='' ">
             #{createTime},
        </if>
        <if test="productType !=null and productType !='' ">
             #{productType},
        </if>
        <if test="salesStatus !=null and salesStatus !='' ">
             #{salesStatus},
        </if>
        </trim>

    </insert>

</mapper>
