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

    <select id="selectSHyglJfglMemberpointsinfoList" parameterType="pd" resultType="pd">
        select * from s_hygl_jfgl_memberpointsinfo where 1=1
        <if test="memberCardNo !=null and memberCardNo !='' ">
            and memberCardNo = #{memberCardNo}
        </if>
        <if test="memberName !=null and memberName !='' ">
            and memberName = #{memberName}
        </if>
        <if test="phoneNumber !=null and phoneNumber !='' ">
            and phoneNumber = #{phoneNumber}
        </if>
        <if test="pickupStore !=null and pickupStore !='' ">
            and pickupStore = #{pickupStore}
        </if>
        <if test="remainingPoints !=null and remainingPoints !='' ">
            and remainingPoints = #{remainingPoints}
        </if>
        <if test="pointsAdjustment !=null and pointsAdjustment !='' ">
            and pointsAdjustment = #{pointsAdjustment}
        </if>
        <if test="pointsAdjustmentReason !=null and pointsAdjustmentReason !='' ">
            and pointsAdjustmentReason = #{pointsAdjustmentReason}
        </if>
        <if test="pointsChangeTime !=null and pointsChangeTime !='' ">
            and pointsChangeTime = #{pointsChangeTime}
        </if>
        <if test="query != null and query != ''">
            AND (memberCardNo LIKE CONCAT('%', #{query}, '%')
            OR phoneNumber = #{query})
        </if>
    </select>


    <update id="updateSHyglJfglMemberpointsinfo" parameterType="pd" >
        update s_hygl_jfgl_memberpointsinfo
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="memberCardNo !=null and memberCardNo !='' ">
            memberCardNo = #{memberCardNo},
        </if>
        <if test="memberName !=null and memberName !='' ">
            memberName = #{memberName},
        </if>
        <if test="phoneNumber !=null and phoneNumber !='' ">
            phoneNumber = #{phoneNumber},
        </if>
        <if test="pickupStore !=null and pickupStore !='' ">
            pickupStore = #{pickupStore},
        </if>
        <if test="remainingPoints !=null and remainingPoints !='' ">
            remainingPoints = #{remainingPoints},
        </if>
        <if test="pointsAdjustment !=null and pointsAdjustment !='' ">
            pointsAdjustment = #{pointsAdjustment},
        </if>
        <if test="pointsAdjustmentReason !=null and pointsAdjustmentReason !='' ">
            pointsAdjustmentReason = #{pointsAdjustmentReason},
        </if>
        <if test="pointsChangeTime !=null and pointsChangeTime !='' ">
            pointsChangeTime = #{pointsChangeTime},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="memberCardNo !=null and memberCardNo !='' ">
            memberCardNo,
        </if>
        <if test="memberName !=null and memberName !='' ">
            memberName,
        </if>
        <if test="phoneNumber !=null and phoneNumber !='' ">
            phoneNumber,
        </if>
        <if test="pickupStore !=null and pickupStore !='' ">
            pickupStore,
        </if>
        <if test="remainingPoints !=null and remainingPoints !='' ">
            remainingPoints,
        </if>
        <if test="pointsAdjustment !=null and pointsAdjustment !='' ">
            pointsAdjustment,
        </if>
        <if test="pointsAdjustmentReason !=null and pointsAdjustmentReason !='' ">
            pointsAdjustmentReason,
        </if>
        <if test="pointsChangeTime !=null and pointsChangeTime !='' ">
            pointsChangeTime,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="memberCardNo !=null and memberCardNo !='' ">
             #{memberCardNo},
        </if>
        <if test="memberName !=null and memberName !='' ">
             #{memberName},
        </if>
        <if test="phoneNumber !=null and phoneNumber !='' ">
             #{phoneNumber},
        </if>
        <if test="pickupStore !=null and pickupStore !='' ">
             #{pickupStore},
        </if>
        <if test="remainingPoints !=null and remainingPoints !='' ">
             #{remainingPoints},
        </if>
        <if test="pointsAdjustment !=null and pointsAdjustment !='' ">
             #{pointsAdjustment},
        </if>
        <if test="pointsAdjustmentReason !=null and pointsAdjustmentReason !='' ">
             #{pointsAdjustmentReason},
        </if>
        <if test="pointsChangeTime !=null and pointsChangeTime !='' ">
             #{pointsChangeTime},
        </if>
        </trim>

    </insert>

</mapper>
