<?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="com.reptileclient.jlifeapp.dao.hm.HmPaymentOrderMapper">
    <resultMap id="BaseResultMap" type="com.reptileclient.jlifeapp.entity.hm.HmPaymentOrder">
        <id column="id" property="id" jdbcType="BIGINT"/>
        <result column="agreement_order_no" property="agreementOrderNo" jdbcType="VARCHAR"/>
        <result column="buyer_address" property="buyerAddress" jdbcType="VARCHAR"/>
        <result column="buyer_name" property="buyerName" jdbcType="VARCHAR"/>
        <result column="buyer_nick" property="buyerNick" jdbcType="VARCHAR"/>
        <result column="buyer_phone" property="buyerPhone" jdbcType="VARCHAR"/>
        <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
        <result column="creator_name" property="creatorName" jdbcType="VARCHAR"/>
        <result column="customer_name" property="customerName" jdbcType="VARCHAR"/>
        <result column="customer_phone" property="customerPhone" jdbcType="VARCHAR"/>
        <result column="deliver_place" property="deliverPlace" jdbcType="INTEGER"/>
        <result column="deliver_place_name" property="deliverPlaceName" jdbcType="VARCHAR"/>
        <result column="deliver_way" property="deliverWay" jdbcType="INTEGER"/>
        <result column="deliver_way_name" property="deliverWayName" jdbcType="VARCHAR"/>
        <result column="gmt_create" property="gmtCreate" jdbcType="BIGINT"/>
        <result column="gmt_modified" property="gmtModified" jdbcType="BIGINT"/>
        <result column="guide_name" property="guideName" jdbcType="VARCHAR"/>
        <result column="guide_phone" property="guidePhone" jdbcType="VARCHAR"/>
        <result column="guide_remark" property="guideRemark" jdbcType="VARCHAR"/>
        <result column="hm_order_id" property="hmOrderId" jdbcType="VARCHAR"/>
        <result column="item_name" property="itemName" jdbcType="VARCHAR"/>
        <result column="origin_fee" property="originFee" jdbcType="DECIMAL"/>
        <result column="pay_fee" property="payFee" jdbcType="DECIMAL"/>
        <result column="pay_time" property="payTime" jdbcType="TIMESTAMP"/>
        <result column="payment_no" property="paymentNo" jdbcType="VARCHAR"/>
        <result column="service_contract_no" property="serviceContractNo" jdbcType="VARCHAR"/>
        <result column="service_fulfill_type" property="serviceFulfillType" jdbcType="INTEGER"/>
        <result column="service_fulfill_type_name" property="serviceFulfillTypeName" jdbcType="VARCHAR"/>
        <result column="shop_code" property="shopCode" jdbcType="VARCHAR"/>
        <result column="shop_name" property="shopName" jdbcType="VARCHAR"/>
        <result column="shop_id" property="shopId" jdbcType="INTEGER"/>
        <result column="status" property="status" jdbcType="INTEGER"/>
        <result column="status_desc" property="statusDesc" jdbcType="VARCHAR"/>
        <result column="tb_order_id" property="tbOrderId" jdbcType="VARCHAR"/>
        <result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
    </resultMap>
    <sql id="Base_Column_List">
        id
        , agreement_order_no, buyer_address, buyer_name, buyer_nick, buyer_phone, create_time,
    creator_name, customer_name, customer_phone, deliver_place, deliver_place_name, deliver_way,
    deliver_way_name, gmt_create, gmt_modified, guide_name, guide_phone, guide_remark,
    hm_order_id, item_name, origin_fee, pay_fee, pay_time, payment_no, service_contract_no,
    service_fulfill_type, service_fulfill_type_name, shop_code, shop_name, shop_id, status,
    status_desc, tb_order_id, update_time
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List"/>
        from hm_payment_order
        where id = #{id,jdbcType=BIGINT}
    </select>
    <select id="selectNewOne" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from hm_payment_order
        where 1 = 1
        <if test="shopCode != null and shopCode !=''">
            and shop_code = #{shopCode}
        </if>
        order by create_time desc
        limit 1
    </select>
    <select id="selectByPaymentNo" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from hm_payment_order
        where payment_no = #{paymentNo}
        order by id desc
        limit 1
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
        delete
        from hm_payment_order
        where id = #{id,jdbcType=BIGINT}
    </delete>
    <delete id="deleteByCreateTime">
        delete
        from hm_payment_order
        where create_time >= #{createTime}
        <if test="shopCode != null and shopCode !=''">
            and shop_code = #{shopCode}
        </if>
    </delete>
    <delete id="deleteByBuyerPhone">
        delete
        from hm_payment_order
        where buyer_phone = #{buyerPhone}
    </delete>
    <!-- <delete id="deleteDistinctData">
        DELETE
        FROM `hm_payment_order`
        WHERE payment_no IN
              (SELECT payment_no
               FROM (SELECT payment_no
                     FROM hm_payment_order
                     GROUP BY payment_no
                     HAVING COUNT(payment_no) > 1) a)
          AND id NOT IN
              (SELECT *
               FROM (SELECT MAX(id)
                     FROM `hm_payment_order`
                     GROUP BY payment_no
                     HAVING COUNT(payment_no) > 1) b)
          and create_time >= #{dateTime}
    </delete> -->
    <delete id="deleteDistinctData">
         delete from `hm_payment_order` where id in (
            select id from (
                select id,row_number() over(partition by payment_no order by id asc ) cnt from `hm_payment_order`
                  where create_time >= #{dateTime}

              ) a where a.cnt>1
        )
    </delete>
    <delete id="deleteByBetWeenTime">
        delete
        from hm_payment_order
        where create_time between #{startTime} and #{endTime}
    </delete>
    <insert id="insert" parameterType="com.reptileclient.jlifeapp.entity.hm.HmPaymentOrder">
        insert into hm_payment_order (id, agreement_order_no, buyer_address,
                                      buyer_name, buyer_nick, buyer_phone,
                                      create_time, creator_name, customer_name,
                                      customer_phone, deliver_place, deliver_place_name,
                                      deliver_way, deliver_way_name, gmt_create,
                                      gmt_modified, guide_name, guide_phone,
                                      guide_remark, hm_order_id, item_name,
                                      origin_fee, pay_fee, pay_time,
                                      payment_no, service_contract_no, service_fulfill_type,
                                      service_fulfill_type_name, shop_code, shop_name,
                                      shop_id, status, status_desc,
                                      tb_order_id, update_time,sku_code)
        values (#{id,jdbcType=BIGINT}, #{agreementOrderNo,jdbcType=VARCHAR}, #{buyerAddress,jdbcType=VARCHAR},
                #{buyerName,jdbcType=VARCHAR}, #{buyerNick,jdbcType=VARCHAR}, #{buyerPhone,jdbcType=VARCHAR},
                #{createTime,jdbcType=TIMESTAMP}, #{creatorName,jdbcType=VARCHAR}, #{customerName,jdbcType=VARCHAR},
                #{customerPhone,jdbcType=VARCHAR}, #{deliverPlace,jdbcType=INTEGER},
                #{deliverPlaceName,jdbcType=VARCHAR},
                #{deliverWay,jdbcType=INTEGER}, #{deliverWayName,jdbcType=VARCHAR}, #{gmtCreate,jdbcType=BIGINT},
                #{gmtModified,jdbcType=BIGINT}, #{guideName,jdbcType=VARCHAR}, #{guidePhone,jdbcType=VARCHAR},
                #{guideRemark,jdbcType=VARCHAR}, #{hmOrderId,jdbcType=VARCHAR}, #{itemName,jdbcType=VARCHAR},
                #{originFee,jdbcType=DECIMAL}, #{payFee,jdbcType=DECIMAL}, #{payTime,jdbcType=TIMESTAMP},
                #{paymentNo,jdbcType=VARCHAR}, #{serviceContractNo,jdbcType=VARCHAR},
                #{serviceFulfillType,jdbcType=INTEGER},
                #{serviceFulfillTypeName,jdbcType=VARCHAR}, #{shopCode,jdbcType=VARCHAR}, #{shopName,jdbcType=VARCHAR},
                #{shopId,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{statusDesc,jdbcType=VARCHAR},
                #{tbOrderId,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP},#{skuCode,jdbcType=VARCHAR})
    </insert>
    <insert id="insertSelective" parameterType="com.reptileclient.jlifeapp.entity.hm.HmPaymentOrder">
        insert into hm_payment_order
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="agreementOrderNo != null">
                agreement_order_no,
            </if>
            <if test="buyerAddress != null">
                buyer_address,
            </if>
            <if test="buyerName != null">
                buyer_name,
            </if>
            <if test="buyerNick != null">
                buyer_nick,
            </if>
            <if test="buyerPhone != null">
                buyer_phone,
            </if>
            <if test="createTime != null">
                create_time,
            </if>
            <if test="creatorName != null">
                creator_name,
            </if>
            <if test="customerName != null">
                customer_name,
            </if>
            <if test="customerPhone != null">
                customer_phone,
            </if>
            <if test="deliverPlace != null">
                deliver_place,
            </if>
            <if test="deliverPlaceName != null">
                deliver_place_name,
            </if>
            <if test="deliverWay != null">
                deliver_way,
            </if>
            <if test="deliverWayName != null">
                deliver_way_name,
            </if>
            <if test="gmtCreate != null">
                gmt_create,
            </if>
            <if test="gmtModified != null">
                gmt_modified,
            </if>
            <if test="guideName != null">
                guide_name,
            </if>
            <if test="guidePhone != null">
                guide_phone,
            </if>
            <if test="guideRemark != null">
                guide_remark,
            </if>
            <if test="hmOrderId != null">
                hm_order_id,
            </if>
            <if test="itemName != null">
                item_name,
            </if>
            <if test="originFee != null">
                origin_fee,
            </if>
            <if test="payFee != null">
                pay_fee,
            </if>
            <if test="payTime != null">
                pay_time,
            </if>
            <if test="paymentNo != null">
                payment_no,
            </if>
            <if test="serviceContractNo != null">
                service_contract_no,
            </if>
            <if test="serviceFulfillType != null">
                service_fulfill_type,
            </if>
            <if test="serviceFulfillTypeName != null">
                service_fulfill_type_name,
            </if>
            <if test="shopCode != null">
                shop_code,
            </if>
            <if test="shopName != null">
                shop_name,
            </if>
            <if test="shopId != null">
                shop_id,
            </if>
            <if test="status != null">
                status,
            </if>
            <if test="statusDesc != null">
                status_desc,
            </if>
            <if test="tbOrderId != null">
                tb_order_id,
            </if>
            <if test="updateTime != null">
                update_time,
            </if>
             <if test="skuCode != null">
                sku_code,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=BIGINT},
            </if>
            <if test="agreementOrderNo != null">
                #{agreementOrderNo,jdbcType=VARCHAR},
            </if>
            <if test="buyerAddress != null">
                #{buyerAddress,jdbcType=VARCHAR},
            </if>
            <if test="buyerName != null">
                #{buyerName,jdbcType=VARCHAR},
            </if>
            <if test="buyerNick != null">
                #{buyerNick,jdbcType=VARCHAR},
            </if>
            <if test="buyerPhone != null">
                #{buyerPhone,jdbcType=VARCHAR},
            </if>
            <if test="createTime != null">
                #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="creatorName != null">
                #{creatorName,jdbcType=VARCHAR},
            </if>
            <if test="customerName != null">
                #{customerName,jdbcType=VARCHAR},
            </if>
            <if test="customerPhone != null">
                #{customerPhone,jdbcType=VARCHAR},
            </if>
            <if test="deliverPlace != null">
                #{deliverPlace,jdbcType=INTEGER},
            </if>
            <if test="deliverPlaceName != null">
                #{deliverPlaceName,jdbcType=VARCHAR},
            </if>
            <if test="deliverWay != null">
                #{deliverWay,jdbcType=INTEGER},
            </if>
            <if test="deliverWayName != null">
                #{deliverWayName,jdbcType=VARCHAR},
            </if>
            <if test="gmtCreate != null">
                #{gmtCreate,jdbcType=BIGINT},
            </if>
            <if test="gmtModified != null">
                #{gmtModified,jdbcType=BIGINT},
            </if>
            <if test="guideName != null">
                #{guideName,jdbcType=VARCHAR},
            </if>
            <if test="guidePhone != null">
                #{guidePhone,jdbcType=VARCHAR},
            </if>
            <if test="guideRemark != null">
                #{guideRemark,jdbcType=VARCHAR},
            </if>
            <if test="hmOrderId != null">
                #{hmOrderId,jdbcType=VARCHAR},
            </if>
            <if test="itemName != null">
                #{itemName,jdbcType=VARCHAR},
            </if>
            <if test="originFee != null">
                #{originFee,jdbcType=DECIMAL},
            </if>
            <if test="payFee != null">
                #{payFee,jdbcType=DECIMAL},
            </if>
            <if test="payTime != null">
                #{payTime,jdbcType=TIMESTAMP},
            </if>
            <if test="paymentNo != null">
                #{paymentNo,jdbcType=VARCHAR},
            </if>
            <if test="serviceContractNo != null">
                #{serviceContractNo,jdbcType=VARCHAR},
            </if>
            <if test="serviceFulfillType != null">
                #{serviceFulfillType,jdbcType=INTEGER},
            </if>
            <if test="serviceFulfillTypeName != null">
                #{serviceFulfillTypeName,jdbcType=VARCHAR},
            </if>
            <if test="shopCode != null">
                #{shopCode,jdbcType=VARCHAR},
            </if>
            <if test="shopName != null">
                #{shopName,jdbcType=VARCHAR},
            </if>
            <if test="shopId != null">
                #{shopId,jdbcType=INTEGER},
            </if>
            <if test="status != null">
                #{status,jdbcType=INTEGER},
            </if>
            <if test="statusDesc != null">
                #{statusDesc,jdbcType=VARCHAR},
            </if>
            <if test="tbOrderId != null">
                #{tbOrderId,jdbcType=VARCHAR},
            </if>
            <if test="updateTime != null">
                #{updateTime,jdbcType=TIMESTAMP},
            </if>
             <if test="skuCode != null">
                #{skuCode,jdbcType=VARCHAR},
            </if>

        </trim>
    </insert>

    <insert id="insertSelective_test15" parameterType="com.reptileclient.jlifeapp.entity.hm.HmPaymentOrder">
        insert into hm_payment_order_test15
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">
                id,
            </if>
            <if test="agreementOrderNo != null">
                agreement_order_no,
            </if>
            <if test="buyerAddress != null">
                buyer_address,
            </if>
            <if test="buyerName != null">
                buyer_name,
            </if>
            <if test="buyerNick != null">
                buyer_nick,
            </if>
            <if test="buyerPhone != null">
                buyer_phone,
            </if>
            <if test="createTime != null">
                create_time,
            </if>
            <if test="creatorName != null">
                creator_name,
            </if>
            <if test="customerName != null">
                customer_name,
            </if>
            <if test="customerPhone != null">
                customer_phone,
            </if>
            <if test="deliverPlace != null">
                deliver_place,
            </if>
            <if test="deliverPlaceName != null">
                deliver_place_name,
            </if>
            <if test="deliverWay != null">
                deliver_way,
            </if>
            <if test="deliverWayName != null">
                deliver_way_name,
            </if>
            <if test="gmtCreate != null">
                gmt_create,
            </if>
            <if test="gmtModified != null">
                gmt_modified,
            </if>
            <if test="guideName != null">
                guide_name,
            </if>
            <if test="guidePhone != null">
                guide_phone,
            </if>
            <if test="guideRemark != null">
                guide_remark,
            </if>
            <if test="hmOrderId != null">
                hm_order_id,
            </if>
            <if test="itemName != null">
                item_name,
            </if>
            <if test="originFee != null">
                origin_fee,
            </if>
            <if test="payFee != null">
                pay_fee,
            </if>
            <if test="payTime != null">
                pay_time,
            </if>
            <if test="paymentNo != null">
                payment_no,
            </if>
            <if test="serviceContractNo != null">
                service_contract_no,
            </if>
            <if test="serviceFulfillType != null">
                service_fulfill_type,
            </if>
            <if test="serviceFulfillTypeName != null">
                service_fulfill_type_name,
            </if>
            <if test="shopCode != null">
                shop_code,
            </if>
            <if test="shopName != null">
                shop_name,
            </if>
            <if test="shopId != null">
                shop_id,
            </if>
            <if test="status != null">
                status,
            </if>
            <if test="statusDesc != null">
                status_desc,
            </if>
            <if test="tbOrderId != null">
                tb_order_id,
            </if>
            <if test="updateTime != null">
                update_time,
            </if>
             <if test="skuCode != null">
                sku_code,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">
                #{id,jdbcType=BIGINT},
            </if>
            <if test="agreementOrderNo != null">
                #{agreementOrderNo,jdbcType=VARCHAR},
            </if>
            <if test="buyerAddress != null">
                #{buyerAddress,jdbcType=VARCHAR},
            </if>
            <if test="buyerName != null">
                #{buyerName,jdbcType=VARCHAR},
            </if>
            <if test="buyerNick != null">
                #{buyerNick,jdbcType=VARCHAR},
            </if>
            <if test="buyerPhone != null">
                #{buyerPhone,jdbcType=VARCHAR},
            </if>
            <if test="createTime != null">
                #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="creatorName != null">
                #{creatorName,jdbcType=VARCHAR},
            </if>
            <if test="customerName != null">
                #{customerName,jdbcType=VARCHAR},
            </if>
            <if test="customerPhone != null">
                #{customerPhone,jdbcType=VARCHAR},
            </if>
            <if test="deliverPlace != null">
                #{deliverPlace,jdbcType=INTEGER},
            </if>
            <if test="deliverPlaceName != null">
                #{deliverPlaceName,jdbcType=VARCHAR},
            </if>
            <if test="deliverWay != null">
                #{deliverWay,jdbcType=INTEGER},
            </if>
            <if test="deliverWayName != null">
                #{deliverWayName,jdbcType=VARCHAR},
            </if>
            <if test="gmtCreate != null">
                #{gmtCreate,jdbcType=BIGINT},
            </if>
            <if test="gmtModified != null">
                #{gmtModified,jdbcType=BIGINT},
            </if>
            <if test="guideName != null">
                #{guideName,jdbcType=VARCHAR},
            </if>
            <if test="guidePhone != null">
                #{guidePhone,jdbcType=VARCHAR},
            </if>
            <if test="guideRemark != null">
                #{guideRemark,jdbcType=VARCHAR},
            </if>
            <if test="hmOrderId != null">
                #{hmOrderId,jdbcType=VARCHAR},
            </if>
            <if test="itemName != null">
                #{itemName,jdbcType=VARCHAR},
            </if>
            <if test="originFee != null">
                #{originFee,jdbcType=DECIMAL},
            </if>
            <if test="payFee != null">
                #{payFee,jdbcType=DECIMAL},
            </if>
            <if test="payTime != null">
                #{payTime,jdbcType=TIMESTAMP},
            </if>
            <if test="paymentNo != null">
                #{paymentNo,jdbcType=VARCHAR},
            </if>
            <if test="serviceContractNo != null">
                #{serviceContractNo,jdbcType=VARCHAR},
            </if>
            <if test="serviceFulfillType != null">
                #{serviceFulfillType,jdbcType=INTEGER},
            </if>
            <if test="serviceFulfillTypeName != null">
                #{serviceFulfillTypeName,jdbcType=VARCHAR},
            </if>
            <if test="shopCode != null">
                #{shopCode,jdbcType=VARCHAR},
            </if>
            <if test="shopName != null">
                #{shopName,jdbcType=VARCHAR},
            </if>
            <if test="shopId != null">
                #{shopId,jdbcType=INTEGER},
            </if>
            <if test="status != null">
                #{status,jdbcType=INTEGER},
            </if>
            <if test="statusDesc != null">
                #{statusDesc,jdbcType=VARCHAR},
            </if>
            <if test="tbOrderId != null">
                #{tbOrderId,jdbcType=VARCHAR},
            </if>
            <if test="updateTime != null">
                #{updateTime,jdbcType=TIMESTAMP},
            </if>
             <if test="skuCode != null">
                #{skuCode,jdbcType=VARCHAR},
            </if>

        </trim>
    </insert>

    <insert id="insertByBatch">
        insert into hm_payment_order (agreement_order_no, buyer_address,
        buyer_name, buyer_nick, buyer_phone,
        create_time, creator_name, customer_name,
        customer_phone, deliver_place, deliver_place_name,
        deliver_way, deliver_way_name, gmt_create,
        gmt_modified, guide_name, guide_phone,
        guide_remark, hm_order_id, item_name,
        origin_fee, pay_fee, pay_time,
        payment_no, service_contract_no, service_fulfill_type,
        service_fulfill_type_name, shop_code, shop_name,
        shop_id, status, status_desc,
        tb_order_id)
        values
        <foreach collection="list" item="item" index="index" separator=",">
            (#{item.agreementOrderNo,jdbcType=VARCHAR}, #{item.buyerAddress,jdbcType=VARCHAR},
            #{item.buyerName,jdbcType=VARCHAR}, #{item.buyerNick,jdbcType=VARCHAR}, #{item.buyerPhone,jdbcType=VARCHAR},
            #{item.createTime,jdbcType=TIMESTAMP}, #{item.creatorName,jdbcType=VARCHAR},
            #{item.customerName,jdbcType=VARCHAR},
            #{item.customerPhone,jdbcType=VARCHAR}, #{item.deliverPlace,jdbcType=INTEGER},
            #{item.deliverPlaceName,jdbcType=VARCHAR},
            #{item.deliverWay,jdbcType=INTEGER}, #{item.deliverWayName,jdbcType=VARCHAR},
            #{item.gmtCreate,jdbcType=BIGINT},
            #{item.gmtModified,jdbcType=BIGINT}, #{item.guideName,jdbcType=VARCHAR},
            #{item.guidePhone,jdbcType=VARCHAR},
            #{item.guideRemark,jdbcType=VARCHAR}, #{item.hmOrderId,jdbcType=VARCHAR}, #{item.itemName,jdbcType=VARCHAR},
            #{item.originFee,jdbcType=DECIMAL}, #{item.payFee,jdbcType=DECIMAL}, #{item.payTime,jdbcType=TIMESTAMP},
            #{item.paymentNo,jdbcType=VARCHAR}, #{item.serviceContractNo,jdbcType=VARCHAR},
            #{item.serviceFulfillType,jdbcType=INTEGER},
            #{item.serviceFulfillTypeName,jdbcType=VARCHAR}, #{item.shopCode,jdbcType=VARCHAR},
            #{item.shopName,jdbcType=VARCHAR},
            #{item.shopId,jdbcType=INTEGER}, #{item.status,jdbcType=INTEGER}, #{item.statusDesc,jdbcType=VARCHAR},
            #{item.tbOrderId,jdbcType=VARCHAR})
        </foreach>
    </insert>
    <update id="updateByPrimaryKeySelective" parameterType="com.reptileclient.jlifeapp.entity.hm.HmPaymentOrder">
        update hm_payment_order
        <set>
            <if test="agreementOrderNo != null">
                agreement_order_no = #{agreementOrderNo,jdbcType=VARCHAR},
            </if>
            <if test="buyerAddress != null">
                buyer_address = #{buyerAddress,jdbcType=VARCHAR},
            </if>
            <if test="buyerName != null">
                buyer_name = #{buyerName,jdbcType=VARCHAR},
            </if>
            <if test="buyerNick != null">
                buyer_nick = #{buyerNick,jdbcType=VARCHAR},
            </if>
            <if test="buyerPhone != null">
                buyer_phone = #{buyerPhone,jdbcType=VARCHAR},
            </if>
            <if test="createTime != null">
                create_time = #{createTime,jdbcType=TIMESTAMP},
            </if>
            <if test="creatorName != null">
                creator_name = #{creatorName,jdbcType=VARCHAR},
            </if>
            <if test="customerName != null">
                customer_name = #{customerName,jdbcType=VARCHAR},
            </if>
            <if test="customerPhone != null">
                customer_phone = #{customerPhone,jdbcType=VARCHAR},
            </if>
            <if test="deliverPlace != null">
                deliver_place = #{deliverPlace,jdbcType=INTEGER},
            </if>
            <if test="deliverPlaceName != null">
                deliver_place_name = #{deliverPlaceName,jdbcType=VARCHAR},
            </if>
            <if test="deliverWay != null">
                deliver_way = #{deliverWay,jdbcType=INTEGER},
            </if>
            <if test="deliverWayName != null">
                deliver_way_name = #{deliverWayName,jdbcType=VARCHAR},
            </if>
            <if test="gmtCreate != null">
                gmt_create = #{gmtCreate,jdbcType=BIGINT},
            </if>
            <if test="gmtModified != null">
                gmt_modified = #{gmtModified,jdbcType=BIGINT},
            </if>
            <if test="guideName != null">
                guide_name = #{guideName,jdbcType=VARCHAR},
            </if>
            <if test="guidePhone != null">
                guide_phone = #{guidePhone,jdbcType=VARCHAR},
            </if>
            <if test="guideRemark != null">
                guide_remark = #{guideRemark,jdbcType=VARCHAR},
            </if>
            <if test="hmOrderId != null">
                hm_order_id = #{hmOrderId,jdbcType=VARCHAR},
            </if>
            <if test="itemName != null">
                item_name = #{itemName,jdbcType=VARCHAR},
            </if>
            <if test="originFee != null">
                origin_fee = #{originFee,jdbcType=DECIMAL},
            </if>
            <if test="payFee != null">
                pay_fee = #{payFee,jdbcType=DECIMAL},
            </if>
            <if test="payTime != null">
                pay_time = #{payTime,jdbcType=TIMESTAMP},
            </if>
            <if test="paymentNo != null">
                payment_no = #{paymentNo,jdbcType=VARCHAR},
            </if>
            <if test="serviceContractNo != null">
                service_contract_no = #{serviceContractNo,jdbcType=VARCHAR},
            </if>
            <if test="serviceFulfillType != null">
                service_fulfill_type = #{serviceFulfillType,jdbcType=INTEGER},
            </if>
            <if test="serviceFulfillTypeName != null">
                service_fulfill_type_name = #{serviceFulfillTypeName,jdbcType=VARCHAR},
            </if>
            <if test="shopCode != null">
                shop_code = #{shopCode,jdbcType=VARCHAR},
            </if>
            <if test="shopName != null">
                shop_name = #{shopName,jdbcType=VARCHAR},
            </if>
            <if test="shopId != null">
                shop_id = #{shopId,jdbcType=INTEGER},
            </if>
            <if test="status != null">
                status = #{status,jdbcType=INTEGER},
            </if>
            <if test="statusDesc != null">
                status_desc = #{statusDesc,jdbcType=VARCHAR},
            </if>
            <if test="tbOrderId != null">
                tb_order_id = #{tbOrderId,jdbcType=VARCHAR},
            </if>
            <if test="updateTime != null">
                update_time = #{updateTime,jdbcType=TIMESTAMP},
            </if>
        </set>
        where id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKey" parameterType="com.reptileclient.jlifeapp.entity.hm.HmPaymentOrder">
        update hm_payment_order
        set status                    = #{status,jdbcType=INTEGER},
            status_desc               = #{statusDesc,jdbcType=VARCHAR},
            update_time               = #{updateTime,jdbcType=TIMESTAMP},
             hm_order_id = #{hmOrderId,jdbcType=VARCHAR},
             tb_order_id = #{tbOrderId,jdbcType=VARCHAR},
             pay_fee = #{payFee,jdbcType=DECIMAL},
             pay_time = #{payTime,jdbcType=TIMESTAMP}
        where id = #{id,jdbcType=BIGINT}
    </update>

    <select id="selectEncryptPhone" resultMap="BaseResultMap">
        select id,buyer_phone,payment_no from hm_payment_order
       where buyer_phone like '%*%'
    </select>

    <select id="sp_update_phone_by_payment" statementType="CALLABLE">
        {call sp_update_phone_by_payment()}
    </select>

    <select id="etlCustomer" statementType="CALLABLE">
        {call jlife_nurse.sp_etl_customer()}
    </select>

</mapper>
