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

    <select id="selectSYxglKjglHxjlRecordList" parameterType="pd" resultType="pd">
        select * from s_yxgl_kjgl_hxjl_record where 1=1
        <if test="couponName !=null and couponName !='' ">
            and couponName = #{couponName}
        </if>
        <if test="couponNumber !=null and couponNumber !='' ">
            and couponNumber = #{couponNumber}
        </if>
        <if test="faceValue !=null and faceValue !='' ">
            and faceValue = #{faceValue}
        </if>
        <if test="deductionAmount !=null and deductionAmount !='' ">
            and deductionAmount = #{deductionAmount}
        </if>
        <if test="type !=null and type !='' ">
            and type = #{type}
        </if>
        <if test="discountRate !=null and discountRate !='' ">
            and discountRate = #{discountRate}
        </if>
        <if test="getTime !=null and getTime !='' ">
            and getTime = #{getTime}
        </if>
        <if test="issuingStore !=null and issuingStore !='' ">
            and issuingStore = #{issuingStore}
        </if>
        <if test="issuingStoreMDMCode !=null and issuingStoreMDMCode !='' ">
            and issuingStoreMDMCode = #{issuingStoreMDMCode}
        </if>
        <if test="redemptionTime !=null and redemptionTime !='' ">
            and redemptionTime = #{redemptionTime}
        </if>
        <if test="redemptionStatus !=null and redemptionStatus !='' ">
            and redemptionStatus = #{redemptionStatus}
        </if>
        <if test="redeemingStore !=null and redeemingStore !='' ">
            and redeemingStore = #{redeemingStore}
        </if>
        <if test="redeemingStoreMDMCode !=null and redeemingStoreMDMCode !='' ">
            and redeemingStoreMDMCode = #{redeemingStoreMDMCode}
        </if>
        <if test="storeRegion !=null and storeRegion !='' ">
            and storeRegion = #{storeRegion}
        </if>
        <if test="redemptionUser !=null and redemptionUser !='' ">
            and redemptionUser = #{redemptionUser}
        </if>
        <if test="erpMemberCardNo !=null and erpMemberCardNo !='' ">
            and erpMemberCardNo = #{erpMemberCardNo}
        </if>
        <if test="usedBy !=null and usedBy !='' ">
            and usedBy = #{usedBy}
        </if>
        <if test="phoneNumber !=null and phoneNumber !='' ">
            and phoneNumber = #{phoneNumber}
        </if>
        <if test="orderNo !=null and orderNo !='' ">
            and orderNo = #{orderNo}
        </if>
        <if test="sameStoreRedemption !=null and sameStoreRedemption !='' ">
            and sameStoreRedemption = #{sameStoreRedemption}
        </if>
    </select>


    <update id="updateSYxglKjglHxjlRecord" parameterType="pd" >
        update s_yxgl_kjgl_hxjl_record
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="couponName !=null and couponName !='' ">
            couponName = #{couponName},
        </if>
        <if test="couponNumber !=null and couponNumber !='' ">
            couponNumber = #{couponNumber},
        </if>
        <if test="faceValue !=null and faceValue !='' ">
            faceValue = #{faceValue},
        </if>
        <if test="deductionAmount !=null and deductionAmount !='' ">
            deductionAmount = #{deductionAmount},
        </if>
        <if test="type !=null and type !='' ">
            type = #{type},
        </if>
        <if test="discountRate !=null and discountRate !='' ">
            discountRate = #{discountRate},
        </if>
        <if test="getTime !=null and getTime !='' ">
            getTime = #{getTime},
        </if>
        <if test="issuingStore !=null and issuingStore !='' ">
            issuingStore = #{issuingStore},
        </if>
        <if test="issuingStoreMDMCode !=null and issuingStoreMDMCode !='' ">
            issuingStoreMDMCode = #{issuingStoreMDMCode},
        </if>
        <if test="redemptionTime !=null and redemptionTime !='' ">
            redemptionTime = #{redemptionTime},
        </if>
        <if test="redemptionStatus !=null and redemptionStatus !='' ">
            redemptionStatus = #{redemptionStatus},
        </if>
        <if test="redeemingStore !=null and redeemingStore !='' ">
            redeemingStore = #{redeemingStore},
        </if>
        <if test="redeemingStoreMDMCode !=null and redeemingStoreMDMCode !='' ">
            redeemingStoreMDMCode = #{redeemingStoreMDMCode},
        </if>
        <if test="storeRegion !=null and storeRegion !='' ">
            storeRegion = #{storeRegion},
        </if>
        <if test="redemptionUser !=null and redemptionUser !='' ">
            redemptionUser = #{redemptionUser},
        </if>
        <if test="erpMemberCardNo !=null and erpMemberCardNo !='' ">
            erpMemberCardNo = #{erpMemberCardNo},
        </if>
        <if test="usedBy !=null and usedBy !='' ">
            usedBy = #{usedBy},
        </if>
        <if test="phoneNumber !=null and phoneNumber !='' ">
            phoneNumber = #{phoneNumber},
        </if>
        <if test="orderNo !=null and orderNo !='' ">
            orderNo = #{orderNo},
        </if>
        <if test="sameStoreRedemption !=null and sameStoreRedemption !='' ">
            sameStoreRedemption = #{sameStoreRedemption},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="couponName !=null and couponName !='' ">
            couponName,
        </if>
        <if test="couponNumber !=null and couponNumber !='' ">
            couponNumber,
        </if>
        <if test="faceValue !=null and faceValue !='' ">
            faceValue,
        </if>
        <if test="deductionAmount !=null and deductionAmount !='' ">
            deductionAmount,
        </if>
        <if test="type !=null and type !='' ">
            type,
        </if>
        <if test="discountRate !=null and discountRate !='' ">
            discountRate,
        </if>
        <if test="getTime !=null and getTime !='' ">
            getTime,
        </if>
        <if test="issuingStore !=null and issuingStore !='' ">
            issuingStore,
        </if>
        <if test="issuingStoreMDMCode !=null and issuingStoreMDMCode !='' ">
            issuingStoreMDMCode,
        </if>
        <if test="redemptionTime !=null and redemptionTime !='' ">
            redemptionTime,
        </if>
        <if test="redemptionStatus !=null and redemptionStatus !='' ">
            redemptionStatus,
        </if>
        <if test="redeemingStore !=null and redeemingStore !='' ">
            redeemingStore,
        </if>
        <if test="redeemingStoreMDMCode !=null and redeemingStoreMDMCode !='' ">
            redeemingStoreMDMCode,
        </if>
        <if test="storeRegion !=null and storeRegion !='' ">
            storeRegion,
        </if>
        <if test="redemptionUser !=null and redemptionUser !='' ">
            redemptionUser,
        </if>
        <if test="erpMemberCardNo !=null and erpMemberCardNo !='' ">
            erpMemberCardNo,
        </if>
        <if test="usedBy !=null and usedBy !='' ">
            usedBy,
        </if>
        <if test="phoneNumber !=null and phoneNumber !='' ">
            phoneNumber,
        </if>
        <if test="orderNo !=null and orderNo !='' ">
            orderNo,
        </if>
        <if test="sameStoreRedemption !=null and sameStoreRedemption !='' ">
            sameStoreRedemption,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="couponName !=null and couponName !='' ">
             #{couponName},
        </if>
        <if test="couponNumber !=null and couponNumber !='' ">
             #{couponNumber},
        </if>
        <if test="faceValue !=null and faceValue !='' ">
             #{faceValue},
        </if>
        <if test="deductionAmount !=null and deductionAmount !='' ">
             #{deductionAmount},
        </if>
        <if test="type !=null and type !='' ">
             #{type},
        </if>
        <if test="discountRate !=null and discountRate !='' ">
             #{discountRate},
        </if>
        <if test="getTime !=null and getTime !='' ">
             #{getTime},
        </if>
        <if test="issuingStore !=null and issuingStore !='' ">
             #{issuingStore},
        </if>
        <if test="issuingStoreMDMCode !=null and issuingStoreMDMCode !='' ">
             #{issuingStoreMDMCode},
        </if>
        <if test="redemptionTime !=null and redemptionTime !='' ">
             #{redemptionTime},
        </if>
        <if test="redemptionStatus !=null and redemptionStatus !='' ">
             #{redemptionStatus},
        </if>
        <if test="redeemingStore !=null and redeemingStore !='' ">
             #{redeemingStore},
        </if>
        <if test="redeemingStoreMDMCode !=null and redeemingStoreMDMCode !='' ">
             #{redeemingStoreMDMCode},
        </if>
        <if test="storeRegion !=null and storeRegion !='' ">
             #{storeRegion},
        </if>
        <if test="redemptionUser !=null and redemptionUser !='' ">
             #{redemptionUser},
        </if>
        <if test="erpMemberCardNo !=null and erpMemberCardNo !='' ">
             #{erpMemberCardNo},
        </if>
        <if test="usedBy !=null and usedBy !='' ">
             #{usedBy},
        </if>
        <if test="phoneNumber !=null and phoneNumber !='' ">
             #{phoneNumber},
        </if>
        <if test="orderNo !=null and orderNo !='' ">
             #{orderNo},
        </if>
        <if test="sameStoreRedemption !=null and sameStoreRedemption !='' ">
             #{sameStoreRedemption},
        </if>
        </trim>

    </insert>

</mapper>
