<?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.PaymentTradeLogMapper">
  <resultMap id="BaseResultMap" type="com.neusoft.smart.pos.payment.persistent.domain.PaymentTradeLog">
    <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="pay_type" jdbcType="VARCHAR" property="payType" />
    <result column="description" jdbcType="VARCHAR" property="description" />
    <result column="request_type" jdbcType="CHAR" property="requestType" />
    <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>
  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.neusoft.smart.pos.payment.persistent.domain.PaymentTradeLogWithBLOBs">
    <result column="send_data" jdbcType="LONGVARCHAR" property="sendData" />
    <result column="receive_data" jdbcType="LONGVARCHAR" property="receiveData" />
  </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, pay_type, description, request_type, created_at, created_by, 
    updated_by, updated_at
  </sql>
  <sql id="Blob_Column_List">
    send_data, receive_data
  </sql>
  <select id="selectByExampleWithBLOBs" parameterType="com.neusoft.smart.pos.payment.persistent.domain.PaymentTradeLogExample" resultMap="ResultMapWithBLOBs">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from payment_trade_log
    <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="selectByExample" parameterType="com.neusoft.smart.pos.payment.persistent.domain.PaymentTradeLogExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from payment_trade_log
    <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="ResultMapWithBLOBs">
    select 
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from payment_trade_log
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from payment_trade_log
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="com.neusoft.smart.pos.payment.persistent.domain.PaymentTradeLogExample">
    delete from payment_trade_log
    <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.PaymentTradeLogWithBLOBs" useGeneratedKeys="true">
    insert into payment_trade_log (mcode, m_order_number, pay_type, 
      description, request_type, created_at, 
      created_by, updated_by, updated_at, 
      send_data, receive_data)
    values (#{mcode,jdbcType=VARCHAR}, #{mOrderNumber,jdbcType=VARCHAR}, #{payType,jdbcType=VARCHAR}, 
      #{description,jdbcType=VARCHAR}, #{requestType,jdbcType=CHAR}, #{createdAt,jdbcType=TIMESTAMP}, 
      #{createdBy,jdbcType=VARCHAR}, #{updatedBy,jdbcType=VARCHAR}, #{updatedAt,jdbcType=TIMESTAMP}, 
      #{sendData,jdbcType=LONGVARCHAR}, #{receiveData,jdbcType=LONGVARCHAR})
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.neusoft.smart.pos.payment.persistent.domain.PaymentTradeLogWithBLOBs" useGeneratedKeys="true">
    insert into payment_trade_log
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="mcode != null">
        mcode,
      </if>
      <if test="mOrderNumber != null">
        m_order_number,
      </if>
      <if test="payType != null">
        pay_type,
      </if>
      <if test="description != null">
        description,
      </if>
      <if test="requestType != null">
        request_type,
      </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>
      <if test="sendData != null">
        send_data,
      </if>
      <if test="receiveData != null">
        receive_data,
      </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="payType != null">
        #{payType,jdbcType=VARCHAR},
      </if>
      <if test="description != null">
        #{description,jdbcType=VARCHAR},
      </if>
      <if test="requestType != null">
        #{requestType,jdbcType=CHAR},
      </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>
      <if test="sendData != null">
        #{sendData,jdbcType=LONGVARCHAR},
      </if>
      <if test="receiveData != null">
        #{receiveData,jdbcType=LONGVARCHAR},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.neusoft.smart.pos.payment.persistent.domain.PaymentTradeLogExample" resultType="java.lang.Integer">
    select count(*) from payment_trade_log
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update payment_trade_log
    <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.payType != null">
        pay_type = #{record.payType,jdbcType=VARCHAR},
      </if>
      <if test="record.description != null">
        description = #{record.description,jdbcType=VARCHAR},
      </if>
      <if test="record.requestType != null">
        request_type = #{record.requestType,jdbcType=CHAR},
      </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>
      <if test="record.sendData != null">
        send_data = #{record.sendData,jdbcType=LONGVARCHAR},
      </if>
      <if test="record.receiveData != null">
        receive_data = #{record.receiveData,jdbcType=LONGVARCHAR},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExampleWithBLOBs" parameterType="map">
    update payment_trade_log
    set id = #{record.id,jdbcType=INTEGER},
      mcode = #{record.mcode,jdbcType=VARCHAR},
      m_order_number = #{record.mOrderNumber,jdbcType=VARCHAR},
      pay_type = #{record.payType,jdbcType=VARCHAR},
      description = #{record.description,jdbcType=VARCHAR},
      request_type = #{record.requestType,jdbcType=CHAR},
      created_at = #{record.createdAt,jdbcType=TIMESTAMP},
      created_by = #{record.createdBy,jdbcType=VARCHAR},
      updated_by = #{record.updatedBy,jdbcType=VARCHAR},
      updated_at = #{record.updatedAt,jdbcType=TIMESTAMP},
      send_data = #{record.sendData,jdbcType=LONGVARCHAR},
      receive_data = #{record.receiveData,jdbcType=LONGVARCHAR}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update payment_trade_log
    set id = #{record.id,jdbcType=INTEGER},
      mcode = #{record.mcode,jdbcType=VARCHAR},
      m_order_number = #{record.mOrderNumber,jdbcType=VARCHAR},
      pay_type = #{record.payType,jdbcType=VARCHAR},
      description = #{record.description,jdbcType=VARCHAR},
      request_type = #{record.requestType,jdbcType=CHAR},
      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.PaymentTradeLogWithBLOBs">
    update payment_trade_log
    <set>
      <if test="mcode != null">
        mcode = #{mcode,jdbcType=VARCHAR},
      </if>
      <if test="mOrderNumber != null">
        m_order_number = #{mOrderNumber,jdbcType=VARCHAR},
      </if>
      <if test="payType != null">
        pay_type = #{payType,jdbcType=VARCHAR},
      </if>
      <if test="description != null">
        description = #{description,jdbcType=VARCHAR},
      </if>
      <if test="requestType != null">
        request_type = #{requestType,jdbcType=CHAR},
      </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>
      <if test="sendData != null">
        send_data = #{sendData,jdbcType=LONGVARCHAR},
      </if>
      <if test="receiveData != null">
        receive_data = #{receiveData,jdbcType=LONGVARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.neusoft.smart.pos.payment.persistent.domain.PaymentTradeLogWithBLOBs">
    update payment_trade_log
    set mcode = #{mcode,jdbcType=VARCHAR},
      m_order_number = #{mOrderNumber,jdbcType=VARCHAR},
      pay_type = #{payType,jdbcType=VARCHAR},
      description = #{description,jdbcType=VARCHAR},
      request_type = #{requestType,jdbcType=CHAR},
      created_at = #{createdAt,jdbcType=TIMESTAMP},
      created_by = #{createdBy,jdbcType=VARCHAR},
      updated_by = #{updatedBy,jdbcType=VARCHAR},
      updated_at = #{updatedAt,jdbcType=TIMESTAMP},
      send_data = #{sendData,jdbcType=LONGVARCHAR},
      receive_data = #{receiveData,jdbcType=LONGVARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.neusoft.smart.pos.payment.persistent.domain.PaymentTradeLog">
    update payment_trade_log
    set mcode = #{mcode,jdbcType=VARCHAR},
      m_order_number = #{mOrderNumber,jdbcType=VARCHAR},
      pay_type = #{payType,jdbcType=VARCHAR},
      description = #{description,jdbcType=VARCHAR},
      request_type = #{requestType,jdbcType=CHAR},
      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 payment_trade_log  (mcode, m_order_number, pay_type, 
        description, request_type, created_at, 
        created_by, updated_by, updated_at, 
        send_data, receive_data)
      values
      <foreach collection="items" item="item" index="index" separator=",">
      (#{item.mcode,jdbcType=VARCHAR}, #{item.mOrderNumber,jdbcType=VARCHAR}, #{item.payType,jdbcType=VARCHAR}, 
        #{item.description,jdbcType=VARCHAR}, #{item.requestType,jdbcType=CHAR}, #{item.createdAt,jdbcType=TIMESTAMP}, 
        #{item.createdBy,jdbcType=VARCHAR}, #{item.updatedBy,jdbcType=VARCHAR}, #{item.updatedAt,jdbcType=TIMESTAMP}, 
        #{item.sendData,jdbcType=LONGVARCHAR}, #{item.receiveData,jdbcType=LONGVARCHAR})
      </foreach>
    </if>
  </insert>
</mapper>