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

    <select id="selectSFwglServercommissionrewardinfoList" parameterType="pd" resultType="pd">
        select * from s_fwgl_servercommissionrewardinfo 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="servicePackageOrderNumber !=null and servicePackageOrderNumber !='' ">
            and servicePackageOrderNumber = #{servicePackageOrderNumber}
        </if>
        <if test="voucherRedemptionOrderNumber !=null and voucherRedemptionOrderNumber !='' ">
            and voucherRedemptionOrderNumber = #{voucherRedemptionOrderNumber}
        </if>
        <if test="chain !=null and chain !='' ">
            and chain = #{chain}
        </if>
        <if test="store !=null and store !='' ">
            and store = #{store}
        </if>
        <if test="voucherCode !=null and voucherCode !='' ">
            and voucherCode = #{voucherCode}
        </if>
        <if test="staffNumber !=null and staffNumber !='' ">
            and staffNumber = #{staffNumber}
        </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="contractOrderID !=null and contractOrderID !='' ">
            and contractOrderID = #{contractOrderID}
        </if>
        <if test="status !=null and status !='' ">
            and status = #{status}
        </if>
    </select>


    <update id="updateSFwglServercommissionrewardinfo" parameterType="pd" >
        update s_fwgl_servercommissionrewardinfo
        <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="servicePackageOrderNumber !=null and servicePackageOrderNumber !='' ">
            servicePackageOrderNumber = #{servicePackageOrderNumber},
        </if>
        <if test="voucherRedemptionOrderNumber !=null and voucherRedemptionOrderNumber !='' ">
            voucherRedemptionOrderNumber = #{voucherRedemptionOrderNumber},
        </if>
        <if test="chain !=null and chain !='' ">
            chain = #{chain},
        </if>
        <if test="store !=null and store !='' ">
            store = #{store},
        </if>
        <if test="voucherCode !=null and voucherCode !='' ">
            voucherCode = #{voucherCode},
        </if>
        <if test="staffNumber !=null and staffNumber !='' ">
            staffNumber = #{staffNumber},
        </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="contractOrderID !=null and contractOrderID !='' ">
            contractOrderID = #{contractOrderID},
        </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="SFwglServercommissionrewardinfoRemove" parameterType="pd">
        <if test="ids != null">
            delete from s_fwgl_servercommissionrewardinfo where
            <if test="ids != null">
                id in(${ids})
            </if>
        </if>
    </delete>

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

        insert into s_fwgl_servercommissionrewardinfo
        <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="servicePackageOrderNumber !=null and servicePackageOrderNumber !='' ">
            servicePackageOrderNumber,
        </if>
        <if test="voucherRedemptionOrderNumber !=null and voucherRedemptionOrderNumber !='' ">
            voucherRedemptionOrderNumber,
        </if>
        <if test="chain !=null and chain !='' ">
            chain,
        </if>
        <if test="store !=null and store !='' ">
            store,
        </if>
        <if test="voucherCode !=null and voucherCode !='' ">
            voucherCode,
        </if>
        <if test="staffNumber !=null and staffNumber !='' ">
            staffNumber,
        </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="contractOrderID !=null and contractOrderID !='' ">
            contractOrderID,
        </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="servicePackageOrderNumber !=null and servicePackageOrderNumber !='' ">
             #{servicePackageOrderNumber},
        </if>
        <if test="voucherRedemptionOrderNumber !=null and voucherRedemptionOrderNumber !='' ">
             #{voucherRedemptionOrderNumber},
        </if>
        <if test="chain !=null and chain !='' ">
             #{chain},
        </if>
        <if test="store !=null and store !='' ">
             #{store},
        </if>
        <if test="voucherCode !=null and voucherCode !='' ">
             #{voucherCode},
        </if>
        <if test="staffNumber !=null and staffNumber !='' ">
             #{staffNumber},
        </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="contractOrderID !=null and contractOrderID !='' ">
             #{contractOrderID},
        </if>
        <if test="status !=null and status !='' ">
             #{status},
        </if>
        </trim>

    </insert>

</mapper>
