<?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.jsowell.pile.mapper.AdapayCallbackRecordMapper">
  <resultMap id="BaseResultMap" type="com.jsowell.pile.domain.AdapayCallbackRecord">
    <id column="id" property="id" />
    <result column="member_id" jdbcType="VARCHAR" property="memberId" />
    <result column="order_code" jdbcType="VARCHAR" property="orderCode" />
    <result column="pay_scenario" jdbcType="VARCHAR" property="payScenario" />
    <result column="payment_id" jdbcType="VARCHAR" property="paymentId" />
    <result column="app_id" jdbcType="VARCHAR" property="appId" />
    <result column="description" jdbcType="VARCHAR" property="description" />
    <result column="created_time" jdbcType="VARCHAR" property="createdTime" />
    <result column="end_time" jdbcType="VARCHAR" property="endTime" />
    <result column="expend" jdbcType="OTHER" property="expend" />
    <result column="fee_amt" jdbcType="DECIMAL" property="feeAmt" />
    <result column="order_no" jdbcType="VARCHAR" property="orderNo" />
    <result column="out_trans_id" jdbcType="VARCHAR" property="outTransId" />
    <result column="party_order_id" jdbcType="VARCHAR" property="partyOrderId" />
    <result column="pay_amt" jdbcType="DECIMAL" property="payAmt" />
    <result column="pay_channel" jdbcType="VARCHAR" property="payChannel" />
    <result column="real_amt" jdbcType="DECIMAL" property="realAmt" />
    <result column="share_eq" jdbcType="VARCHAR" property="shareEq" />
    <result column="status" jdbcType="VARCHAR" property="status" />
    <result column="wx_user_id" jdbcType="VARCHAR" property="wxUserId" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="del_flag" jdbcType="VARCHAR" property="delFlag" />
  </resultMap>
  <sql id="Base_Column_List">
    id, member_id, order_code, pay_scenario, payment_id, app_id, description, created_time, end_time, expend, fee_amt, order_no, out_trans_id,
    party_order_id, pay_amt, pay_channel, real_amt, share_eq, `status`, wx_user_id, create_time, 
    del_flag
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from adapay_callback_record
    where id = #{id,jdbcType=VARCHAR}
  </select>
  <select id="selectByOrderCode" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from adapay_callback_record
    where del_flag = '0'
        and order_code = #{orderCode,jdbcType=VARCHAR}
  </select>
    <select id="selectByPaymentId" resultMap="BaseResultMap">
      select
      <include refid="Base_Column_List" />
      from adapay_callback_record
      where del_flag = '0'
      and payment_id = #{paymentId,jdbcType=VARCHAR}
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from adapay_callback_record
    where id = #{id,jdbcType=VARCHAR}
  </delete>
  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.AdapayCallbackRecord" useGeneratedKeys="true">
    insert into adapay_callback_record (member_id, order_code, pay_scenario, payment_id, app_id, description, created_time,
      end_time, expend, fee_amt, 
      order_no, out_trans_id, party_order_id, 
      pay_amt, pay_channel, real_amt, 
      share_eq, `status`, wx_user_id)
    values (#{memberId,jdbcType=VARCHAR}, #{orderCode,jdbcType=VARCHAR}, #{payScenario,jdbcType=VARCHAR},
            #{paymentId,jdbcType=VARCHAR},#{appId,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{createdTime,jdbcType=VARCHAR},
      #{endTime,jdbcType=VARCHAR}, #{expend,jdbcType=OTHER}, #{feeAmt,jdbcType=DECIMAL}, 
      #{orderNo,jdbcType=VARCHAR}, #{outTransId,jdbcType=VARCHAR}, #{partyOrderId,jdbcType=VARCHAR}, 
      #{payAmt,jdbcType=DECIMAL}, #{payChannel,jdbcType=VARCHAR}, #{realAmt,jdbcType=DECIMAL}, 
      #{shareEq,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{wxUserId,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.AdapayCallbackRecord" useGeneratedKeys="true">
    insert into adapay_callback_record
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="memberId != null">
        member_id,
      </if>
      <if test="orderCode != null">
        order_code,
      </if>
      <if test="payScenario != null">
        pay_scenario,
      </if>
      <if test="paymentId != null">
        payment_id,
      </if>
      <if test="appId != null">
        app_id,
      </if>
      <if test="description != null">
        description,
      </if>
      <if test="createdTime != null">
        created_time,
      </if>
      <if test="endTime != null">
        end_time,
      </if>
      <if test="expend != null">
        expend,
      </if>
      <if test="feeAmt != null">
        fee_amt,
      </if>
      <if test="orderNo != null">
        order_no,
      </if>
      <if test="outTransId != null">
        out_trans_id,
      </if>
      <if test="partyOrderId != null">
        party_order_id,
      </if>
      <if test="payAmt != null">
        pay_amt,
      </if>
      <if test="payChannel != null">
        pay_channel,
      </if>
      <if test="realAmt != null">
        real_amt,
      </if>
      <if test="shareEq != null">
        share_eq,
      </if>
      <if test="status != null">
        `status`,
      </if>
      <if test="wxUserId != null">
        wx_user_id,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="delFlag != null">
        del_flag,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="memberId != null">
        #{memberId,jdbcType=VARCHAR},
      </if>
      <if test="orderCode != null">
        #{orderCode,jdbcType=VARCHAR},
      </if>
      <if test="payScenario != null">
        #{payScenario,jdbcType=VARCHAR},
      </if>
      <if test="paymentId != null">
        #{paymentId,jdbcType=VARCHAR},
      </if>
      <if test="appId != null">
        #{appId,jdbcType=VARCHAR},
      </if>
      <if test="description != null">
        #{description,jdbcType=VARCHAR},
      </if>
      <if test="createdTime != null">
        #{createdTime,jdbcType=VARCHAR},
      </if>
      <if test="endTime != null">
        #{endTime,jdbcType=VARCHAR},
      </if>
      <if test="expend != null">
        #{expend,jdbcType=OTHER},
      </if>
      <if test="feeAmt != null">
        #{feeAmt,jdbcType=DECIMAL},
      </if>
      <if test="orderNo != null">
        #{orderNo,jdbcType=VARCHAR},
      </if>
      <if test="outTransId != null">
        #{outTransId,jdbcType=VARCHAR},
      </if>
      <if test="partyOrderId != null">
        #{partyOrderId,jdbcType=VARCHAR},
      </if>
      <if test="payAmt != null">
        #{payAmt,jdbcType=DECIMAL},
      </if>
      <if test="payChannel != null">
        #{payChannel,jdbcType=VARCHAR},
      </if>
      <if test="realAmt != null">
        #{realAmt,jdbcType=DECIMAL},
      </if>
      <if test="shareEq != null">
        #{shareEq,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        #{status,jdbcType=VARCHAR},
      </if>
      <if test="wxUserId != null">
        #{wxUserId,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="delFlag != null">
        #{delFlag,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.jsowell.pile.domain.AdapayCallbackRecord">
    update adapay_callback_record
    <set>
      <if test="memberId != null">
        member_id = #{memberId,jdbcType=VARCHAR},
      </if>
      <if test="orderCode != null">
        order_code = #{orderCode,jdbcType=VARCHAR},
      </if>
      <if test="payScenario != null">
        pay_scenario = #{payScenario,jdbcType=VARCHAR},
      </if>
      <if test="paymentId != null">
        payment_id = #{paymentId,jdbcType=VARCHAR},
      </if>
      <if test="appId != null">
        app_id = #{appId,jdbcType=VARCHAR},
      </if>
      <if test="description != null">
        description = #{description,jdbcType=VARCHAR},
      </if>
      <if test="createdTime != null">
        created_time = #{createdTime,jdbcType=VARCHAR},
      </if>
      <if test="endTime != null">
        end_time = #{endTime,jdbcType=VARCHAR},
      </if>
      <if test="expend != null">
        expend = #{expend,jdbcType=OTHER},
      </if>
      <if test="feeAmt != null">
        fee_amt = #{feeAmt,jdbcType=DECIMAL},
      </if>
      <if test="orderNo != null">
        order_no = #{orderNo,jdbcType=VARCHAR},
      </if>
      <if test="outTransId != null">
        out_trans_id = #{outTransId,jdbcType=VARCHAR},
      </if>
      <if test="partyOrderId != null">
        party_order_id = #{partyOrderId,jdbcType=VARCHAR},
      </if>
      <if test="payAmt != null">
        pay_amt = #{payAmt,jdbcType=DECIMAL},
      </if>
      <if test="payChannel != null">
        pay_channel = #{payChannel,jdbcType=VARCHAR},
      </if>
      <if test="realAmt != null">
        real_amt = #{realAmt,jdbcType=DECIMAL},
      </if>
      <if test="shareEq != null">
        share_eq = #{shareEq,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        `status` = #{status,jdbcType=VARCHAR},
      </if>
      <if test="wxUserId != null">
        wx_user_id = #{wxUserId,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="delFlag != null">
        del_flag = #{delFlag,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.jsowell.pile.domain.AdapayCallbackRecord">
    update adapay_callback_record
    set member_id = #{memberId,jdbcType=VARCHAR},
        order_code = #{orderCode,jdbcType=VARCHAR},
        pay_scenario = #{payScenario,jdbcType=VARCHAR},
        payment_id = #{paymentId,jdbcType=VARCHAR},
        app_id = #{appId,jdbcType=VARCHAR},
      description = #{description,jdbcType=VARCHAR},
      created_time = #{createdTime,jdbcType=VARCHAR},
      end_time = #{endTime,jdbcType=VARCHAR},
      expend = #{expend,jdbcType=OTHER},
      fee_amt = #{feeAmt,jdbcType=DECIMAL},
      order_no = #{orderNo,jdbcType=VARCHAR},
      out_trans_id = #{outTransId,jdbcType=VARCHAR},
      party_order_id = #{partyOrderId,jdbcType=VARCHAR},
      pay_amt = #{payAmt,jdbcType=DECIMAL},
      pay_channel = #{payChannel,jdbcType=VARCHAR},
      real_amt = #{realAmt,jdbcType=DECIMAL},
      share_eq = #{shareEq,jdbcType=VARCHAR},
      `status` = #{status,jdbcType=VARCHAR},
      wx_user_id = #{wxUserId,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      del_flag = #{delFlag,jdbcType=VARCHAR}
    where id = #{id,jdbcType=VARCHAR}
  </update>

  <select id="queryRecordList" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from adapay_callback_record
    where del_flag = '0'
    and order_code in 
    <foreach collection="orderCodeList" item="orderCode" open="(" separator="," close=")">
      #{orderCode,jdbcType=VARCHAR}
    </foreach>
  </select>

  <select id="selectByDateTime" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from adapay_callback_record
    where del_flag = '0'
    and create_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
  </select>
</mapper>