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

    <select id="selectSYxglCzkCzkglValueaddedcardList" parameterType="pd" resultType="pd">
        select * from s_yxgl_czk_czkgl_valueaddedcard where 1=1
        <if test="cardNumber !=null and cardNumber !='' ">
            and cardNumber = #{cardNumber}
        </if>
        <if test="openCardPhone !=null and openCardPhone !='' ">
            and openCardPhone = #{openCardPhone}
        </if>
        <if test="cardType !=null and cardType !='' ">
            and cardType = #{cardType}
        </if>
        <if test="status !=null and status !='' ">
            and status = #{status}
        </if>
        <if test="balance !=null and balance !='' ">
            and balance = #{balance}
        </if>
        <if test="lastTransactionTime !=null and lastTransactionTime !='' ">
            and lastTransactionTime = #{lastTransactionTime}
        </if>
        <if test="validUntil !=null and validUntil !='' ">
            and validUntil = #{validUntil}
        </if>
    </select>


    <update id="updateSYxglCzkCzkglValueaddedcard" parameterType="pd" >
        update s_yxgl_czk_czkgl_valueaddedcard
        <trim prefix=" SET " suffix="" prefixOverrides="," suffixOverrides=",">
        <if test="openCardPhone !=null and openCardPhone !='' ">
            openCardPhone = #{openCardPhone},
        </if>
        <if test="cardType !=null and cardType !='' ">
            cardType = #{cardType},
        </if>
        <if test="status !=null and status !='' ">
            status = #{status},
        </if>
        <if test="balance !=null and balance !='' ">
            balance = #{balance},
        </if>
        <if test="lastTransactionTime !=null and lastTransactionTime !='' ">
            lastTransactionTime = #{lastTransactionTime},
        </if>
        <if test="validUntil !=null and validUntil !='' ">
            validUntil = #{validUntil},
        </if>
        </trim>
        <if test="up != null and up!=''">
            <if test="id != null and id!=''">
                where id=#{id}
            </if>
        </if>
    </update>

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

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

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

        <if test="openCardPhone !=null and openCardPhone !='' ">
            openCardPhone,
        </if>
        <if test="cardType !=null and cardType !='' ">
            cardType,
        </if>
        <if test="status !=null and status !='' ">
            status,
        </if>
        <if test="balance !=null and balance !='' ">
            balance,
        </if>
        <if test="lastTransactionTime !=null and lastTransactionTime !='' ">
            lastTransactionTime,
        </if>
        <if test="validUntil !=null and validUntil !='' ">
            validUntil,
        </if>
        </trim>
        <trim prefix=" VALUES (" suffix=")" prefixOverrides="," suffixOverrides=",">
        <if test="openCardPhone !=null and openCardPhone !='' ">
             #{openCardPhone},
        </if>
        <if test="cardType !=null and cardType !='' ">
             #{cardType},
        </if>
        <if test="status !=null and status !='' ">
             #{status},
        </if>
        <if test="balance !=null and balance !='' ">
             #{balance},
        </if>
        <if test="lastTransactionTime !=null and lastTransactionTime !='' ">
             #{lastTransactionTime},
        </if>
        <if test="validUntil !=null and validUntil !='' ">
             #{validUntil},
        </if>
        </trim>

    </insert>

</mapper>
