<?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.neusoft.smart.pos.payment.persistent.mapper.GrantPayOrderMapper">
  <resultMap id="BaseResultMap" type="com.neusoft.smart.pos.payment.persistent.domain.GrantPayOrder">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="mcode" jdbcType="VARCHAR" property="mcode" />
    <result column="m_order_number" jdbcType="VARCHAR" property="mOrderNumber" />
    <result column="m_pay_order_number" jdbcType="VARCHAR" property="mPayOrderNumber" />
    <result column="trade_id" jdbcType="VARCHAR" property="tradeId" />
    <result column="outer_order_number" jdbcType="VARCHAR" property="outerOrderNumber" />
    <result column="outer_pay_order_number" jdbcType="VARCHAR" property="outerPayOrderNumber" />
    <result column="auth_no" jdbcType="VARCHAR" property="authNo" />
    <result column="payer_user_id" jdbcType="VARCHAR" property="payerUserId" />
    <result column="description" jdbcType="VARCHAR" property="description" />
    <result column="pay_type" jdbcType="VARCHAR" property="payType" />
    <result column="pay_amount" jdbcType="DECIMAL" property="payAmount" />
    <result column="grant_amount" jdbcType="DECIMAL" property="grantAmount" />
    <result column="unfreeze_amount" jdbcType="DECIMAL" property="unfreezeAmount" />
    <result column="notify_url" jdbcType="VARCHAR" property="notifyUrl" />
    <result column="grant_status" jdbcType="CHAR" property="grantStatus" />
    <result column="time_expire" jdbcType="VARCHAR" property="timeExpire" />
    <result column="pay_time" jdbcType="TIMESTAMP" property="payTime" />
    <result column="scan_code" jdbcType="VARCHAR" property="scanCode" />
    <result column="code_url" jdbcType="VARCHAR" property="codeUrl" />
    <result column="pay_ip" jdbcType="VARCHAR" property="payIp" />
    <result column="open_id" jdbcType="VARCHAR" property="openId" />
    <result column="trade_type" jdbcType="VARCHAR" property="tradeType" />
    <result column="grant_time" jdbcType="TIMESTAMP" property="grantTime" />
    <result column="ungrant_time" jdbcType="TIMESTAMP" property="ungrantTime" />
    <result column="reverse_time" jdbcType="TIMESTAMP" property="reverseTime" />
    <result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
    <result column="created_by" jdbcType="VARCHAR" property="createdBy" />
    <result column="updated_by" jdbcType="VARCHAR" property="updatedBy" />
    <result column="updated_at" jdbcType="TIMESTAMP" property="updatedAt" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <where>
      <foreach collection="oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Update_By_Example_Where_Clause">
    <where>
      <foreach collection="example.oredCriteria" item="criteria" separator="or">
        <if test="criteria.valid">
          <trim prefix="(" prefixOverrides="and" suffix=")">
            <foreach collection="criteria.criteria" item="criterion">
              <choose>
                <when test="criterion.noValue">
                  and ${criterion.condition}
                </when>
                <when test="criterion.singleValue">
                  and ${criterion.condition} #{criterion.value}
                </when>
                <when test="criterion.betweenValue">
                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
                </when>
                <when test="criterion.listValue">
                  and ${criterion.condition}
                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List">
    id, mcode, m_order_number, m_pay_order_number, trade_id, outer_order_number, outer_pay_order_number, 
    auth_no, payer_user_id, description, pay_type, pay_amount, grant_amount, unfreeze_amount, 
    notify_url, grant_status, time_expire, pay_time, scan_code, code_url, pay_ip, open_id, 
    trade_type, grant_time, ungrant_time, reverse_time, created_at, created_by, updated_by, 
    updated_at
  </sql>
  <select id="selectByExample" parameterType="com.neusoft.smart.pos.payment.persistent.domain.GrantPayOrderExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from grant_pay_order
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
    <if test="offset != null and limit != null">
      limit ${offset}, ${limit}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from grant_pay_order
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from grant_pay_order
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="com.neusoft.smart.pos.payment.persistent.domain.GrantPayOrderExample">
    delete from grant_pay_order
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.neusoft.smart.pos.payment.persistent.domain.GrantPayOrder" useGeneratedKeys="true">
    insert into grant_pay_order (mcode, m_order_number, m_pay_order_number, 
      trade_id, outer_order_number, outer_pay_order_number, 
      auth_no, payer_user_id, description, 
      pay_type, pay_amount, grant_amount, 
      unfreeze_amount, notify_url, grant_status, 
      time_expire, pay_time, scan_code, 
      code_url, pay_ip, open_id, 
      trade_type, grant_time, ungrant_time, 
      reverse_time, created_at, created_by, 
      updated_by, updated_at)
    values (#{mcode,jdbcType=VARCHAR}, #{mOrderNumber,jdbcType=VARCHAR}, #{mPayOrderNumber,jdbcType=VARCHAR}, 
      #{tradeId,jdbcType=VARCHAR}, #{outerOrderNumber,jdbcType=VARCHAR}, #{outerPayOrderNumber,jdbcType=VARCHAR}, 
      #{authNo,jdbcType=VARCHAR}, #{payerUserId,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, 
      #{payType,jdbcType=VARCHAR}, #{payAmount,jdbcType=DECIMAL}, #{grantAmount,jdbcType=DECIMAL}, 
      #{unfreezeAmount,jdbcType=DECIMAL}, #{notifyUrl,jdbcType=VARCHAR}, #{grantStatus,jdbcType=CHAR}, 
      #{timeExpire,jdbcType=VARCHAR}, #{payTime,jdbcType=TIMESTAMP}, #{scanCode,jdbcType=VARCHAR}, 
      #{codeUrl,jdbcType=VARCHAR}, #{payIp,jdbcType=VARCHAR}, #{openId,jdbcType=VARCHAR}, 
      #{tradeType,jdbcType=VARCHAR}, #{grantTime,jdbcType=TIMESTAMP}, #{ungrantTime,jdbcType=TIMESTAMP}, 
      #{reverseTime,jdbcType=TIMESTAMP}, #{createdAt,jdbcType=TIMESTAMP}, #{createdBy,jdbcType=VARCHAR}, 
      #{updatedBy,jdbcType=VARCHAR}, #{updatedAt,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.neusoft.smart.pos.payment.persistent.domain.GrantPayOrder" useGeneratedKeys="true">
    insert into grant_pay_order
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="mcode != null">
        mcode,
      </if>
      <if test="mOrderNumber != null">
        m_order_number,
      </if>
      <if test="mPayOrderNumber != null">
        m_pay_order_number,
      </if>
      <if test="tradeId != null">
        trade_id,
      </if>
      <if test="outerOrderNumber != null">
        outer_order_number,
      </if>
      <if test="outerPayOrderNumber != null">
        outer_pay_order_number,
      </if>
      <if test="authNo != null">
        auth_no,
      </if>
      <if test="payerUserId != null">
        payer_user_id,
      </if>
      <if test="description != null">
        description,
      </if>
      <if test="payType != null">
        pay_type,
      </if>
      <if test="payAmount != null">
        pay_amount,
      </if>
      <if test="grantAmount != null">
        grant_amount,
      </if>
      <if test="unfreezeAmount != null">
        unfreeze_amount,
      </if>
      <if test="notifyUrl != null">
        notify_url,
      </if>
      <if test="grantStatus != null">
        grant_status,
      </if>
      <if test="timeExpire != null">
        time_expire,
      </if>
      <if test="payTime != null">
        pay_time,
      </if>
      <if test="scanCode != null">
        scan_code,
      </if>
      <if test="codeUrl != null">
        code_url,
      </if>
      <if test="payIp != null">
        pay_ip,
      </if>
      <if test="openId != null">
        open_id,
      </if>
      <if test="tradeType != null">
        trade_type,
      </if>
      <if test="grantTime != null">
        grant_time,
      </if>
      <if test="ungrantTime != null">
        ungrant_time,
      </if>
      <if test="reverseTime != null">
        reverse_time,
      </if>
      <if test="createdAt != null">
        created_at,
      </if>
      <if test="createdBy != null">
        created_by,
      </if>
      <if test="updatedBy != null">
        updated_by,
      </if>
      <if test="updatedAt != null">
        updated_at,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="mcode != null">
        #{mcode,jdbcType=VARCHAR},
      </if>
      <if test="mOrderNumber != null">
        #{mOrderNumber,jdbcType=VARCHAR},
      </if>
      <if test="mPayOrderNumber != null">
        #{mPayOrderNumber,jdbcType=VARCHAR},
      </if>
      <if test="tradeId != null">
        #{tradeId,jdbcType=VARCHAR},
      </if>
      <if test="outerOrderNumber != null">
        #{outerOrderNumber,jdbcType=VARCHAR},
      </if>
      <if test="outerPayOrderNumber != null">
        #{outerPayOrderNumber,jdbcType=VARCHAR},
      </if>
      <if test="authNo != null">
        #{authNo,jdbcType=VARCHAR},
      </if>
      <if test="payerUserId != null">
        #{payerUserId,jdbcType=VARCHAR},
      </if>
      <if test="description != null">
        #{description,jdbcType=VARCHAR},
      </if>
      <if test="payType != null">
        #{payType,jdbcType=VARCHAR},
      </if>
      <if test="payAmount != null">
        #{payAmount,jdbcType=DECIMAL},
      </if>
      <if test="grantAmount != null">
        #{grantAmount,jdbcType=DECIMAL},
      </if>
      <if test="unfreezeAmount != null">
        #{unfreezeAmount,jdbcType=DECIMAL},
      </if>
      <if test="notifyUrl != null">
        #{notifyUrl,jdbcType=VARCHAR},
      </if>
      <if test="grantStatus != null">
        #{grantStatus,jdbcType=CHAR},
      </if>
      <if test="timeExpire != null">
        #{timeExpire,jdbcType=VARCHAR},
      </if>
      <if test="payTime != null">
        #{payTime,jdbcType=TIMESTAMP},
      </if>
      <if test="scanCode != null">
        #{scanCode,jdbcType=VARCHAR},
      </if>
      <if test="codeUrl != null">
        #{codeUrl,jdbcType=VARCHAR},
      </if>
      <if test="payIp != null">
        #{payIp,jdbcType=VARCHAR},
      </if>
      <if test="openId != null">
        #{openId,jdbcType=VARCHAR},
      </if>
      <if test="tradeType != null">
        #{tradeType,jdbcType=VARCHAR},
      </if>
      <if test="grantTime != null">
        #{grantTime,jdbcType=TIMESTAMP},
      </if>
      <if test="ungrantTime != null">
        #{ungrantTime,jdbcType=TIMESTAMP},
      </if>
      <if test="reverseTime != null">
        #{reverseTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createdAt != null">
        #{createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="createdBy != null">
        #{createdBy,jdbcType=VARCHAR},
      </if>
      <if test="updatedBy != null">
        #{updatedBy,jdbcType=VARCHAR},
      </if>
      <if test="updatedAt != null">
        #{updatedAt,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.neusoft.smart.pos.payment.persistent.domain.GrantPayOrderExample" resultType="java.lang.Integer">
    select count(*) from grant_pay_order
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update grant_pay_order
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=INTEGER},
      </if>
      <if test="record.mcode != null">
        mcode = #{record.mcode,jdbcType=VARCHAR},
      </if>
      <if test="record.mOrderNumber != null">
        m_order_number = #{record.mOrderNumber,jdbcType=VARCHAR},
      </if>
      <if test="record.mPayOrderNumber != null">
        m_pay_order_number = #{record.mPayOrderNumber,jdbcType=VARCHAR},
      </if>
      <if test="record.tradeId != null">
        trade_id = #{record.tradeId,jdbcType=VARCHAR},
      </if>
      <if test="record.outerOrderNumber != null">
        outer_order_number = #{record.outerOrderNumber,jdbcType=VARCHAR},
      </if>
      <if test="record.outerPayOrderNumber != null">
        outer_pay_order_number = #{record.outerPayOrderNumber,jdbcType=VARCHAR},
      </if>
      <if test="record.authNo != null">
        auth_no = #{record.authNo,jdbcType=VARCHAR},
      </if>
      <if test="record.payerUserId != null">
        payer_user_id = #{record.payerUserId,jdbcType=VARCHAR},
      </if>
      <if test="record.description != null">
        description = #{record.description,jdbcType=VARCHAR},
      </if>
      <if test="record.payType != null">
        pay_type = #{record.payType,jdbcType=VARCHAR},
      </if>
      <if test="record.payAmount != null">
        pay_amount = #{record.payAmount,jdbcType=DECIMAL},
      </if>
      <if test="record.grantAmount != null">
        grant_amount = #{record.grantAmount,jdbcType=DECIMAL},
      </if>
      <if test="record.unfreezeAmount != null">
        unfreeze_amount = #{record.unfreezeAmount,jdbcType=DECIMAL},
      </if>
      <if test="record.notifyUrl != null">
        notify_url = #{record.notifyUrl,jdbcType=VARCHAR},
      </if>
      <if test="record.grantStatus != null">
        grant_status = #{record.grantStatus,jdbcType=CHAR},
      </if>
      <if test="record.timeExpire != null">
        time_expire = #{record.timeExpire,jdbcType=VARCHAR},
      </if>
      <if test="record.payTime != null">
        pay_time = #{record.payTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.scanCode != null">
        scan_code = #{record.scanCode,jdbcType=VARCHAR},
      </if>
      <if test="record.codeUrl != null">
        code_url = #{record.codeUrl,jdbcType=VARCHAR},
      </if>
      <if test="record.payIp != null">
        pay_ip = #{record.payIp,jdbcType=VARCHAR},
      </if>
      <if test="record.openId != null">
        open_id = #{record.openId,jdbcType=VARCHAR},
      </if>
      <if test="record.tradeType != null">
        trade_type = #{record.tradeType,jdbcType=VARCHAR},
      </if>
      <if test="record.grantTime != null">
        grant_time = #{record.grantTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.ungrantTime != null">
        ungrant_time = #{record.ungrantTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.reverseTime != null">
        reverse_time = #{record.reverseTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.createdAt != null">
        created_at = #{record.createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="record.createdBy != null">
        created_by = #{record.createdBy,jdbcType=VARCHAR},
      </if>
      <if test="record.updatedBy != null">
        updated_by = #{record.updatedBy,jdbcType=VARCHAR},
      </if>
      <if test="record.updatedAt != null">
        updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update grant_pay_order
    set id = #{record.id,jdbcType=INTEGER},
      mcode = #{record.mcode,jdbcType=VARCHAR},
      m_order_number = #{record.mOrderNumber,jdbcType=VARCHAR},
      m_pay_order_number = #{record.mPayOrderNumber,jdbcType=VARCHAR},
      trade_id = #{record.tradeId,jdbcType=VARCHAR},
      outer_order_number = #{record.outerOrderNumber,jdbcType=VARCHAR},
      outer_pay_order_number = #{record.outerPayOrderNumber,jdbcType=VARCHAR},
      auth_no = #{record.authNo,jdbcType=VARCHAR},
      payer_user_id = #{record.payerUserId,jdbcType=VARCHAR},
      description = #{record.description,jdbcType=VARCHAR},
      pay_type = #{record.payType,jdbcType=VARCHAR},
      pay_amount = #{record.payAmount,jdbcType=DECIMAL},
      grant_amount = #{record.grantAmount,jdbcType=DECIMAL},
      unfreeze_amount = #{record.unfreezeAmount,jdbcType=DECIMAL},
      notify_url = #{record.notifyUrl,jdbcType=VARCHAR},
      grant_status = #{record.grantStatus,jdbcType=CHAR},
      time_expire = #{record.timeExpire,jdbcType=VARCHAR},
      pay_time = #{record.payTime,jdbcType=TIMESTAMP},
      scan_code = #{record.scanCode,jdbcType=VARCHAR},
      code_url = #{record.codeUrl,jdbcType=VARCHAR},
      pay_ip = #{record.payIp,jdbcType=VARCHAR},
      open_id = #{record.openId,jdbcType=VARCHAR},
      trade_type = #{record.tradeType,jdbcType=VARCHAR},
      grant_time = #{record.grantTime,jdbcType=TIMESTAMP},
      ungrant_time = #{record.ungrantTime,jdbcType=TIMESTAMP},
      reverse_time = #{record.reverseTime,jdbcType=TIMESTAMP},
      created_at = #{record.createdAt,jdbcType=TIMESTAMP},
      created_by = #{record.createdBy,jdbcType=VARCHAR},
      updated_by = #{record.updatedBy,jdbcType=VARCHAR},
      updated_at = #{record.updatedAt,jdbcType=TIMESTAMP}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.neusoft.smart.pos.payment.persistent.domain.GrantPayOrder">
    update grant_pay_order
    <set>
      <if test="mcode != null">
        mcode = #{mcode,jdbcType=VARCHAR},
      </if>
      <if test="mOrderNumber != null">
        m_order_number = #{mOrderNumber,jdbcType=VARCHAR},
      </if>
      <if test="mPayOrderNumber != null">
        m_pay_order_number = #{mPayOrderNumber,jdbcType=VARCHAR},
      </if>
      <if test="tradeId != null">
        trade_id = #{tradeId,jdbcType=VARCHAR},
      </if>
      <if test="outerOrderNumber != null">
        outer_order_number = #{outerOrderNumber,jdbcType=VARCHAR},
      </if>
      <if test="outerPayOrderNumber != null">
        outer_pay_order_number = #{outerPayOrderNumber,jdbcType=VARCHAR},
      </if>
      <if test="authNo != null">
        auth_no = #{authNo,jdbcType=VARCHAR},
      </if>
      <if test="payerUserId != null">
        payer_user_id = #{payerUserId,jdbcType=VARCHAR},
      </if>
      <if test="description != null">
        description = #{description,jdbcType=VARCHAR},
      </if>
      <if test="payType != null">
        pay_type = #{payType,jdbcType=VARCHAR},
      </if>
      <if test="payAmount != null">
        pay_amount = #{payAmount,jdbcType=DECIMAL},
      </if>
      <if test="grantAmount != null">
        grant_amount = #{grantAmount,jdbcType=DECIMAL},
      </if>
      <if test="unfreezeAmount != null">
        unfreeze_amount = #{unfreezeAmount,jdbcType=DECIMAL},
      </if>
      <if test="notifyUrl != null">
        notify_url = #{notifyUrl,jdbcType=VARCHAR},
      </if>
      <if test="grantStatus != null">
        grant_status = #{grantStatus,jdbcType=CHAR},
      </if>
      <if test="timeExpire != null">
        time_expire = #{timeExpire,jdbcType=VARCHAR},
      </if>
      <if test="payTime != null">
        pay_time = #{payTime,jdbcType=TIMESTAMP},
      </if>
      <if test="scanCode != null">
        scan_code = #{scanCode,jdbcType=VARCHAR},
      </if>
      <if test="codeUrl != null">
        code_url = #{codeUrl,jdbcType=VARCHAR},
      </if>
      <if test="payIp != null">
        pay_ip = #{payIp,jdbcType=VARCHAR},
      </if>
      <if test="openId != null">
        open_id = #{openId,jdbcType=VARCHAR},
      </if>
      <if test="tradeType != null">
        trade_type = #{tradeType,jdbcType=VARCHAR},
      </if>
      <if test="grantTime != null">
        grant_time = #{grantTime,jdbcType=TIMESTAMP},
      </if>
      <if test="ungrantTime != null">
        ungrant_time = #{ungrantTime,jdbcType=TIMESTAMP},
      </if>
      <if test="reverseTime != null">
        reverse_time = #{reverseTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createdAt != null">
        created_at = #{createdAt,jdbcType=TIMESTAMP},
      </if>
      <if test="createdBy != null">
        created_by = #{createdBy,jdbcType=VARCHAR},
      </if>
      <if test="updatedBy != null">
        updated_by = #{updatedBy,jdbcType=VARCHAR},
      </if>
      <if test="updatedAt != null">
        updated_at = #{updatedAt,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.neusoft.smart.pos.payment.persistent.domain.GrantPayOrder">
    update grant_pay_order
    set mcode = #{mcode,jdbcType=VARCHAR},
      m_order_number = #{mOrderNumber,jdbcType=VARCHAR},
      m_pay_order_number = #{mPayOrderNumber,jdbcType=VARCHAR},
      trade_id = #{tradeId,jdbcType=VARCHAR},
      outer_order_number = #{outerOrderNumber,jdbcType=VARCHAR},
      outer_pay_order_number = #{outerPayOrderNumber,jdbcType=VARCHAR},
      auth_no = #{authNo,jdbcType=VARCHAR},
      payer_user_id = #{payerUserId,jdbcType=VARCHAR},
      description = #{description,jdbcType=VARCHAR},
      pay_type = #{payType,jdbcType=VARCHAR},
      pay_amount = #{payAmount,jdbcType=DECIMAL},
      grant_amount = #{grantAmount,jdbcType=DECIMAL},
      unfreeze_amount = #{unfreezeAmount,jdbcType=DECIMAL},
      notify_url = #{notifyUrl,jdbcType=VARCHAR},
      grant_status = #{grantStatus,jdbcType=CHAR},
      time_expire = #{timeExpire,jdbcType=VARCHAR},
      pay_time = #{payTime,jdbcType=TIMESTAMP},
      scan_code = #{scanCode,jdbcType=VARCHAR},
      code_url = #{codeUrl,jdbcType=VARCHAR},
      pay_ip = #{payIp,jdbcType=VARCHAR},
      open_id = #{openId,jdbcType=VARCHAR},
      trade_type = #{tradeType,jdbcType=VARCHAR},
      grant_time = #{grantTime,jdbcType=TIMESTAMP},
      ungrant_time = #{ungrantTime,jdbcType=TIMESTAMP},
      reverse_time = #{reverseTime,jdbcType=TIMESTAMP},
      created_at = #{createdAt,jdbcType=TIMESTAMP},
      created_by = #{createdBy,jdbcType=VARCHAR},
      updated_by = #{updatedBy,jdbcType=VARCHAR},
      updated_at = #{updatedAt,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <insert id="batchInsert">
    <if test="items.get(0) != null">
            insert into grant_pay_order  (mcode, m_order_number, m_pay_order_number, 
        trade_id, outer_order_number, outer_pay_order_number, 
        auth_no, payer_user_id, description, 
        pay_type, pay_amount, grant_amount, 
        unfreeze_amount, notify_url, grant_status, 
        time_expire, pay_time, scan_code, 
        code_url, pay_ip, open_id, 
        trade_type, grant_time, ungrant_time, 
        reverse_time, created_at, created_by, 
        updated_by, updated_at)
      values
      <foreach collection="items" item="item" index="index" separator=",">
      (#{item.mcode,jdbcType=VARCHAR}, #{item.mOrderNumber,jdbcType=VARCHAR}, #{item.mPayOrderNumber,jdbcType=VARCHAR}, 
        #{item.tradeId,jdbcType=VARCHAR}, #{item.outerOrderNumber,jdbcType=VARCHAR}, #{item.outerPayOrderNumber,jdbcType=VARCHAR}, 
        #{item.authNo,jdbcType=VARCHAR}, #{item.payerUserId,jdbcType=VARCHAR}, #{item.description,jdbcType=VARCHAR}, 
        #{item.payType,jdbcType=VARCHAR}, #{item.payAmount,jdbcType=DECIMAL}, #{item.grantAmount,jdbcType=DECIMAL}, 
        #{item.unfreezeAmount,jdbcType=DECIMAL}, #{item.notifyUrl,jdbcType=VARCHAR}, #{item.grantStatus,jdbcType=CHAR}, 
        #{item.timeExpire,jdbcType=VARCHAR}, #{item.payTime,jdbcType=TIMESTAMP}, #{item.scanCode,jdbcType=VARCHAR}, 
        #{item.codeUrl,jdbcType=VARCHAR}, #{item.payIp,jdbcType=VARCHAR}, #{item.openId,jdbcType=VARCHAR}, 
        #{item.tradeType,jdbcType=VARCHAR}, #{item.grantTime,jdbcType=TIMESTAMP}, #{item.ungrantTime,jdbcType=TIMESTAMP}, 
        #{item.reverseTime,jdbcType=TIMESTAMP}, #{item.createdAt,jdbcType=TIMESTAMP}, #{item.createdBy,jdbcType=VARCHAR}, 
        #{item.updatedBy,jdbcType=VARCHAR}, #{item.updatedAt,jdbcType=TIMESTAMP})
      </foreach>
    </if>
  </insert>
</mapper>