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

    <select id="selectSJkglCommissionrewardinfoList" parameterType="pd" resultType="pd">
        select * from s_jkgl_commissionrewardinfo where 1=1
        <if test="commissionSource !=null and commissionSource !='' ">
            and commissionSource = #{commissionSource}
        </if>
        <if test="rewardType !=null and rewardType !='' ">
            and rewardType = #{rewardType}
        </if>
        <if test="occurrenceTime !=null and occurrenceTime !='' ">
            and occurrenceTime = #{occurrenceTime}
        </if>
        <if test="orderNumber !=null and orderNumber !='' ">
            and orderNumber = #{orderNumber}
        </if>
        <if test="chain !=null and chain !='' ">
            and chain = #{chain}
        </if>
        <if test="store !=null and store !='' ">
            and store = #{store}
        </if>
        <if test="couponCode !=null and couponCode !='' ">
            and couponCode = #{couponCode}
        </if>
        <if test="staffCode !=null and staffCode !='' ">
            and staffCode = #{staffCode}
        </if>
        <if test="staffId !=null and staffId !='' ">
            and staffId = #{staffId}
        </if>
        <if test="staffName !=null and staffName !='' ">
            and staffName = #{staffName}
        </if>
        <if test="contractId !=null and contractId !='' ">
            and contractId = #{contractId}
        </if>
        <if test="contractOrderNumber !=null and contractOrderNumber !='' ">
            and contractOrderNumber = #{contractOrderNumber}
        </if>
        <if test="status !=null and status !='' ">
            and status = #{status}
        </if>
    </select>


    <update id="updateSJkglCommissionrewardinfo" parameterType="pd" >
        update s_jkgl_commissionrewardinfo
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="commissionSource !=null and commissionSource !='' ">
            commissionSource = #{commissionSource},
        </if>
        <if test="rewardType !=null and rewardType !='' ">
            rewardType = #{rewardType},
        </if>
        <if test="occurrenceTime !=null and occurrenceTime !='' ">
            occurrenceTime = #{occurrenceTime},
        </if>
        <if test="orderNumber !=null and orderNumber !='' ">
            orderNumber = #{orderNumber},
        </if>
        <if test="chain !=null and chain !='' ">
            chain = #{chain},
        </if>
        <if test="store !=null and store !='' ">
            store = #{store},
        </if>
        <if test="couponCode !=null and couponCode !='' ">
            couponCode = #{couponCode},
        </if>
        <if test="staffCode !=null and staffCode !='' ">
            staffCode = #{staffCode},
        </if>
        <if test="staffId !=null and staffId !='' ">
            staffId = #{staffId},
        </if>
        <if test="staffName !=null and staffName !='' ">
            staffName = #{staffName},
        </if>
        <if test="contractId !=null and contractId !='' ">
            contractId = #{contractId},
        </if>
        <if test="contractOrderNumber !=null and contractOrderNumber !='' ">
            contractOrderNumber = #{contractOrderNumber},
        </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="SJkglCommissionrewardinfoRemove" parameterType="pd">
        <if test="ids != null">
            delete from s_jkgl_commissionrewardinfo where
            <if test="ids != null">
                id in(${ids})
            </if>
        </if>
    </delete>

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

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

        <if test="commissionSource !=null and commissionSource !='' ">
            commissionSource,
        </if>
        <if test="rewardType !=null and rewardType !='' ">
            rewardType,
        </if>
        <if test="occurrenceTime !=null and occurrenceTime !='' ">
            occurrenceTime,
        </if>
        <if test="orderNumber !=null and orderNumber !='' ">
            orderNumber,
        </if>
        <if test="chain !=null and chain !='' ">
            chain,
        </if>
        <if test="store !=null and store !='' ">
            store,
        </if>
        <if test="couponCode !=null and couponCode !='' ">
            couponCode,
        </if>
        <if test="staffCode !=null and staffCode !='' ">
            staffCode,
        </if>
        <if test="staffId !=null and staffId !='' ">
            staffId,
        </if>
        <if test="staffName !=null and staffName !='' ">
            staffName,
        </if>
        <if test="contractId !=null and contractId !='' ">
            contractId,
        </if>
        <if test="contractOrderNumber !=null and contractOrderNumber !='' ">
            contractOrderNumber,
        </if>
        <if test="status !=null and status !='' ">
            status,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="commissionSource !=null and commissionSource !='' ">
             #{commissionSource},
        </if>
        <if test="rewardType !=null and rewardType !='' ">
             #{rewardType},
        </if>
        <if test="occurrenceTime !=null and occurrenceTime !='' ">
             #{occurrenceTime},
        </if>
        <if test="orderNumber !=null and orderNumber !='' ">
             #{orderNumber},
        </if>
        <if test="chain !=null and chain !='' ">
             #{chain},
        </if>
        <if test="store !=null and store !='' ">
             #{store},
        </if>
        <if test="couponCode !=null and couponCode !='' ">
             #{couponCode},
        </if>
        <if test="staffCode !=null and staffCode !='' ">
             #{staffCode},
        </if>
        <if test="staffId !=null and staffId !='' ">
             #{staffId},
        </if>
        <if test="staffName !=null and staffName !='' ">
             #{staffName},
        </if>
        <if test="contractId !=null and contractId !='' ">
             #{contractId},
        </if>
        <if test="contractOrderNumber !=null and contractOrderNumber !='' ">
             #{contractOrderNumber},
        </if>
        <if test="status !=null and status !='' ">
             #{status},
        </if>
        </trim>

    </insert>

</mapper>
