<?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.MchPayChannelMapper">
  <resultMap id="BaseResultMap" type="com.neusoft.smart.pos.payment.persistent.domain.MchPayChannel">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="user_number" jdbcType="INTEGER" property="userNumber" />
    <result column="mcode" jdbcType="VARCHAR" property="mcode" />
    <result column="pay_type" jdbcType="VARCHAR" property="payType" />
    <result column="appid" jdbcType="VARCHAR" property="appid" />
    <result column="mch_id" jdbcType="VARCHAR" property="mchId" />
    <result column="sub_appid" jdbcType="VARCHAR" property="subAppid" />
    <result column="sub_mch_id" jdbcType="VARCHAR" property="subMchId" />
    <result column="secret_key" jdbcType="VARCHAR" property="secretKey" />
    <result column="app_secret_key" jdbcType="VARCHAR" property="appSecretKey" />
    <result column="private_key" jdbcType="VARCHAR" property="privateKey" />
    <result column="public_key" jdbcType="VARCHAR" property="publicKey" />
    <result column="notify_url" jdbcType="VARCHAR" property="notifyUrl" />
    <result column="refund_notify_url" jdbcType="VARCHAR" property="refundNotifyUrl" />
    <result column="is_enable" jdbcType="CHAR" property="isEnable" />
    <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.MchPayChannel">
    <result column="cert" jdbcType="LONGVARBINARY" property="cert" />
  </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, user_number, mcode, pay_type, appid, mch_id, sub_appid, sub_mch_id, secret_key, 
    app_secret_key, private_key, public_key, notify_url, refund_notify_url, is_enable, 
    created_at, created_by, updated_by, updated_at
  </sql>
  <sql id="Blob_Column_List">
    cert
  </sql>
  <select id="selectByExampleWithBLOBs" parameterType="com.neusoft.smart.pos.payment.persistent.domain.MchPayChannelExample" resultMap="ResultMapWithBLOBs">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    ,
    <include refid="Blob_Column_List" />
    from mch_pay_channel
    <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.MchPayChannelExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from mch_pay_channel
    <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 mch_pay_channel
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from mch_pay_channel
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="com.neusoft.smart.pos.payment.persistent.domain.MchPayChannelExample">
    delete from mch_pay_channel
    <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.MchPayChannel" useGeneratedKeys="true">
    insert into mch_pay_channel (user_number, mcode, pay_type, 
      appid, mch_id, sub_appid, 
      sub_mch_id, secret_key, app_secret_key, 
      private_key, public_key, notify_url, 
      refund_notify_url, is_enable, created_at, 
      created_by, updated_by, updated_at, 
      cert)
    values (#{userNumber,jdbcType=INTEGER}, #{mcode,jdbcType=VARCHAR}, #{payType,jdbcType=VARCHAR}, 
      #{appid,jdbcType=VARCHAR}, #{mchId,jdbcType=VARCHAR}, #{subAppid,jdbcType=VARCHAR}, 
      #{subMchId,jdbcType=VARCHAR}, #{secretKey,jdbcType=VARCHAR}, #{appSecretKey,jdbcType=VARCHAR}, 
      #{privateKey,jdbcType=VARCHAR}, #{publicKey,jdbcType=VARCHAR}, #{notifyUrl,jdbcType=VARCHAR}, 
      #{refundNotifyUrl,jdbcType=VARCHAR}, #{isEnable,jdbcType=CHAR}, #{createdAt,jdbcType=TIMESTAMP}, 
      #{createdBy,jdbcType=VARCHAR}, #{updatedBy,jdbcType=VARCHAR}, #{updatedAt,jdbcType=TIMESTAMP}, 
      #{cert,jdbcType=LONGVARBINARY})
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.neusoft.smart.pos.payment.persistent.domain.MchPayChannel" useGeneratedKeys="true">
    insert into mch_pay_channel
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="userNumber != null">
        user_number,
      </if>
      <if test="mcode != null">
        mcode,
      </if>
      <if test="payType != null">
        pay_type,
      </if>
      <if test="appid != null">
        appid,
      </if>
      <if test="mchId != null">
        mch_id,
      </if>
      <if test="subAppid != null">
        sub_appid,
      </if>
      <if test="subMchId != null">
        sub_mch_id,
      </if>
      <if test="secretKey != null">
        secret_key,
      </if>
      <if test="appSecretKey != null">
        app_secret_key,
      </if>
      <if test="privateKey != null">
        private_key,
      </if>
      <if test="publicKey != null">
        public_key,
      </if>
      <if test="notifyUrl != null">
        notify_url,
      </if>
      <if test="refundNotifyUrl != null">
        refund_notify_url,
      </if>
      <if test="isEnable != null">
        is_enable,
      </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="cert != null">
        cert,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="userNumber != null">
        #{userNumber,jdbcType=INTEGER},
      </if>
      <if test="mcode != null">
        #{mcode,jdbcType=VARCHAR},
      </if>
      <if test="payType != null">
        #{payType,jdbcType=VARCHAR},
      </if>
      <if test="appid != null">
        #{appid,jdbcType=VARCHAR},
      </if>
      <if test="mchId != null">
        #{mchId,jdbcType=VARCHAR},
      </if>
      <if test="subAppid != null">
        #{subAppid,jdbcType=VARCHAR},
      </if>
      <if test="subMchId != null">
        #{subMchId,jdbcType=VARCHAR},
      </if>
      <if test="secretKey != null">
        #{secretKey,jdbcType=VARCHAR},
      </if>
      <if test="appSecretKey != null">
        #{appSecretKey,jdbcType=VARCHAR},
      </if>
      <if test="privateKey != null">
        #{privateKey,jdbcType=VARCHAR},
      </if>
      <if test="publicKey != null">
        #{publicKey,jdbcType=VARCHAR},
      </if>
      <if test="notifyUrl != null">
        #{notifyUrl,jdbcType=VARCHAR},
      </if>
      <if test="refundNotifyUrl != null">
        #{refundNotifyUrl,jdbcType=VARCHAR},
      </if>
      <if test="isEnable != null">
        #{isEnable,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="cert != null">
        #{cert,jdbcType=LONGVARBINARY},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.neusoft.smart.pos.payment.persistent.domain.MchPayChannelExample" resultType="java.lang.Integer">
    select count(*) from mch_pay_channel
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update mch_pay_channel
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=INTEGER},
      </if>
      <if test="record.userNumber != null">
        user_number = #{record.userNumber,jdbcType=INTEGER},
      </if>
      <if test="record.mcode != null">
        mcode = #{record.mcode,jdbcType=VARCHAR},
      </if>
      <if test="record.payType != null">
        pay_type = #{record.payType,jdbcType=VARCHAR},
      </if>
      <if test="record.appid != null">
        appid = #{record.appid,jdbcType=VARCHAR},
      </if>
      <if test="record.mchId != null">
        mch_id = #{record.mchId,jdbcType=VARCHAR},
      </if>
      <if test="record.subAppid != null">
        sub_appid = #{record.subAppid,jdbcType=VARCHAR},
      </if>
      <if test="record.subMchId != null">
        sub_mch_id = #{record.subMchId,jdbcType=VARCHAR},
      </if>
      <if test="record.secretKey != null">
        secret_key = #{record.secretKey,jdbcType=VARCHAR},
      </if>
      <if test="record.appSecretKey != null">
        app_secret_key = #{record.appSecretKey,jdbcType=VARCHAR},
      </if>
      <if test="record.privateKey != null">
        private_key = #{record.privateKey,jdbcType=VARCHAR},
      </if>
      <if test="record.publicKey != null">
        public_key = #{record.publicKey,jdbcType=VARCHAR},
      </if>
      <if test="record.notifyUrl != null">
        notify_url = #{record.notifyUrl,jdbcType=VARCHAR},
      </if>
      <if test="record.refundNotifyUrl != null">
        refund_notify_url = #{record.refundNotifyUrl,jdbcType=VARCHAR},
      </if>
      <if test="record.isEnable != null">
        is_enable = #{record.isEnable,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.cert != null">
        cert = #{record.cert,jdbcType=LONGVARBINARY},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExampleWithBLOBs" parameterType="map">
    update mch_pay_channel
    set id = #{record.id,jdbcType=INTEGER},
      user_number = #{record.userNumber,jdbcType=INTEGER},
      mcode = #{record.mcode,jdbcType=VARCHAR},
      pay_type = #{record.payType,jdbcType=VARCHAR},
      appid = #{record.appid,jdbcType=VARCHAR},
      mch_id = #{record.mchId,jdbcType=VARCHAR},
      sub_appid = #{record.subAppid,jdbcType=VARCHAR},
      sub_mch_id = #{record.subMchId,jdbcType=VARCHAR},
      secret_key = #{record.secretKey,jdbcType=VARCHAR},
      app_secret_key = #{record.appSecretKey,jdbcType=VARCHAR},
      private_key = #{record.privateKey,jdbcType=VARCHAR},
      public_key = #{record.publicKey,jdbcType=VARCHAR},
      notify_url = #{record.notifyUrl,jdbcType=VARCHAR},
      refund_notify_url = #{record.refundNotifyUrl,jdbcType=VARCHAR},
      is_enable = #{record.isEnable,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},
      cert = #{record.cert,jdbcType=LONGVARBINARY}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update mch_pay_channel
    set id = #{record.id,jdbcType=INTEGER},
      user_number = #{record.userNumber,jdbcType=INTEGER},
      mcode = #{record.mcode,jdbcType=VARCHAR},
      pay_type = #{record.payType,jdbcType=VARCHAR},
      appid = #{record.appid,jdbcType=VARCHAR},
      mch_id = #{record.mchId,jdbcType=VARCHAR},
      sub_appid = #{record.subAppid,jdbcType=VARCHAR},
      sub_mch_id = #{record.subMchId,jdbcType=VARCHAR},
      secret_key = #{record.secretKey,jdbcType=VARCHAR},
      app_secret_key = #{record.appSecretKey,jdbcType=VARCHAR},
      private_key = #{record.privateKey,jdbcType=VARCHAR},
      public_key = #{record.publicKey,jdbcType=VARCHAR},
      notify_url = #{record.notifyUrl,jdbcType=VARCHAR},
      refund_notify_url = #{record.refundNotifyUrl,jdbcType=VARCHAR},
      is_enable = #{record.isEnable,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.MchPayChannel">
    update mch_pay_channel
    <set>
      <if test="userNumber != null">
        user_number = #{userNumber,jdbcType=INTEGER},
      </if>
      <if test="mcode != null">
        mcode = #{mcode,jdbcType=VARCHAR},
      </if>
      <if test="payType != null">
        pay_type = #{payType,jdbcType=VARCHAR},
      </if>
      <if test="appid != null">
        appid = #{appid,jdbcType=VARCHAR},
      </if>
      <if test="mchId != null">
        mch_id = #{mchId,jdbcType=VARCHAR},
      </if>
      <if test="subAppid != null">
        sub_appid = #{subAppid,jdbcType=VARCHAR},
      </if>
      <if test="subMchId != null">
        sub_mch_id = #{subMchId,jdbcType=VARCHAR},
      </if>
      <if test="secretKey != null">
        secret_key = #{secretKey,jdbcType=VARCHAR},
      </if>
      <if test="appSecretKey != null">
        app_secret_key = #{appSecretKey,jdbcType=VARCHAR},
      </if>
      <if test="privateKey != null">
        private_key = #{privateKey,jdbcType=VARCHAR},
      </if>
      <if test="publicKey != null">
        public_key = #{publicKey,jdbcType=VARCHAR},
      </if>
      <if test="notifyUrl != null">
        notify_url = #{notifyUrl,jdbcType=VARCHAR},
      </if>
      <if test="refundNotifyUrl != null">
        refund_notify_url = #{refundNotifyUrl,jdbcType=VARCHAR},
      </if>
      <if test="isEnable != null">
        is_enable = #{isEnable,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="cert != null">
        cert = #{cert,jdbcType=LONGVARBINARY},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.neusoft.smart.pos.payment.persistent.domain.MchPayChannel">
    update mch_pay_channel
    set user_number = #{userNumber,jdbcType=INTEGER},
      mcode = #{mcode,jdbcType=VARCHAR},
      pay_type = #{payType,jdbcType=VARCHAR},
      appid = #{appid,jdbcType=VARCHAR},
      mch_id = #{mchId,jdbcType=VARCHAR},
      sub_appid = #{subAppid,jdbcType=VARCHAR},
      sub_mch_id = #{subMchId,jdbcType=VARCHAR},
      secret_key = #{secretKey,jdbcType=VARCHAR},
      app_secret_key = #{appSecretKey,jdbcType=VARCHAR},
      private_key = #{privateKey,jdbcType=VARCHAR},
      public_key = #{publicKey,jdbcType=VARCHAR},
      notify_url = #{notifyUrl,jdbcType=VARCHAR},
      refund_notify_url = #{refundNotifyUrl,jdbcType=VARCHAR},
      is_enable = #{isEnable,jdbcType=CHAR},
      created_at = #{createdAt,jdbcType=TIMESTAMP},
      created_by = #{createdBy,jdbcType=VARCHAR},
      updated_by = #{updatedBy,jdbcType=VARCHAR},
      updated_at = #{updatedAt,jdbcType=TIMESTAMP},
      cert = #{cert,jdbcType=LONGVARBINARY}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.neusoft.smart.pos.payment.persistent.domain.MchPayChannel">
    update mch_pay_channel
    set user_number = #{userNumber,jdbcType=INTEGER},
      mcode = #{mcode,jdbcType=VARCHAR},
      pay_type = #{payType,jdbcType=VARCHAR},
      appid = #{appid,jdbcType=VARCHAR},
      mch_id = #{mchId,jdbcType=VARCHAR},
      sub_appid = #{subAppid,jdbcType=VARCHAR},
      sub_mch_id = #{subMchId,jdbcType=VARCHAR},
      secret_key = #{secretKey,jdbcType=VARCHAR},
      app_secret_key = #{appSecretKey,jdbcType=VARCHAR},
      private_key = #{privateKey,jdbcType=VARCHAR},
      public_key = #{publicKey,jdbcType=VARCHAR},
      notify_url = #{notifyUrl,jdbcType=VARCHAR},
      refund_notify_url = #{refundNotifyUrl,jdbcType=VARCHAR},
      is_enable = #{isEnable,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 mch_pay_channel  (user_number, mcode, pay_type, 
        appid, mch_id, sub_appid, 
        sub_mch_id, secret_key, app_secret_key, 
        private_key, public_key, notify_url, 
        refund_notify_url, is_enable, created_at, 
        created_by, updated_by, updated_at, 
        cert)
      values
      <foreach collection="items" item="item" index="index" separator=",">
      (#{item.userNumber,jdbcType=INTEGER}, #{item.mcode,jdbcType=VARCHAR}, #{item.payType,jdbcType=VARCHAR}, 
        #{item.appid,jdbcType=VARCHAR}, #{item.mchId,jdbcType=VARCHAR}, #{item.subAppid,jdbcType=VARCHAR}, 
        #{item.subMchId,jdbcType=VARCHAR}, #{item.secretKey,jdbcType=VARCHAR}, #{item.appSecretKey,jdbcType=VARCHAR}, 
        #{item.privateKey,jdbcType=VARCHAR}, #{item.publicKey,jdbcType=VARCHAR}, #{item.notifyUrl,jdbcType=VARCHAR}, 
        #{item.refundNotifyUrl,jdbcType=VARCHAR}, #{item.isEnable,jdbcType=CHAR}, #{item.createdAt,jdbcType=TIMESTAMP}, 
        #{item.createdBy,jdbcType=VARCHAR}, #{item.updatedBy,jdbcType=VARCHAR}, #{item.updatedAt,jdbcType=TIMESTAMP}, 
        #{item.cert,jdbcType=LONGVARBINARY})
      </foreach>
    </if>
  </insert>
</mapper>