<?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.MchPayInfoMapper">
  <resultMap id="BaseResultMap" type="com.neusoft.smart.pos.payment.persistent.domain.MchPayInfo">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="user_number" jdbcType="INTEGER" property="userNumber" />
    <result column="mcode" jdbcType="VARCHAR" property="mcode" />
    <result column="secret_key" jdbcType="VARCHAR" property="secretKey" />
    <result column="mch_name" jdbcType="VARCHAR" property="mchName" />
    <result column="apply_type" jdbcType="CHAR" property="applyType" />
    <result column="mch_status" jdbcType="CHAR" property="mchStatus" />
    <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, user_number, mcode, secret_key, mch_name, apply_type, mch_status, created_at, 
    created_by, updated_by, updated_at
  </sql>
  <select id="selectByExample" parameterType="com.neusoft.smart.pos.payment.persistent.domain.MchPayInfoExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from mch_pay_info
    <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 mch_pay_info
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from mch_pay_info
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="com.neusoft.smart.pos.payment.persistent.domain.MchPayInfoExample">
    delete from mch_pay_info
    <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.MchPayInfo" useGeneratedKeys="true">
    insert into mch_pay_info (user_number, mcode, secret_key, 
      mch_name, apply_type, mch_status, 
      created_at, created_by, updated_by, 
      updated_at)
    values (#{userNumber,jdbcType=INTEGER}, #{mcode,jdbcType=VARCHAR}, #{secretKey,jdbcType=VARCHAR}, 
      #{mchName,jdbcType=VARCHAR}, #{applyType,jdbcType=CHAR}, #{mchStatus,jdbcType=CHAR}, 
      #{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.MchPayInfo" useGeneratedKeys="true">
    insert into mch_pay_info
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="userNumber != null">
        user_number,
      </if>
      <if test="mcode != null">
        mcode,
      </if>
      <if test="secretKey != null">
        secret_key,
      </if>
      <if test="mchName != null">
        mch_name,
      </if>
      <if test="applyType != null">
        apply_type,
      </if>
      <if test="mchStatus != null">
        mch_status,
      </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="userNumber != null">
        #{userNumber,jdbcType=INTEGER},
      </if>
      <if test="mcode != null">
        #{mcode,jdbcType=VARCHAR},
      </if>
      <if test="secretKey != null">
        #{secretKey,jdbcType=VARCHAR},
      </if>
      <if test="mchName != null">
        #{mchName,jdbcType=VARCHAR},
      </if>
      <if test="applyType != null">
        #{applyType,jdbcType=CHAR},
      </if>
      <if test="mchStatus != null">
        #{mchStatus,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>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.neusoft.smart.pos.payment.persistent.domain.MchPayInfoExample" resultType="java.lang.Integer">
    select count(*) from mch_pay_info
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update mch_pay_info
    <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.secretKey != null">
        secret_key = #{record.secretKey,jdbcType=VARCHAR},
      </if>
      <if test="record.mchName != null">
        mch_name = #{record.mchName,jdbcType=VARCHAR},
      </if>
      <if test="record.applyType != null">
        apply_type = #{record.applyType,jdbcType=CHAR},
      </if>
      <if test="record.mchStatus != null">
        mch_status = #{record.mchStatus,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>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update mch_pay_info
    set id = #{record.id,jdbcType=INTEGER},
      user_number = #{record.userNumber,jdbcType=INTEGER},
      mcode = #{record.mcode,jdbcType=VARCHAR},
      secret_key = #{record.secretKey,jdbcType=VARCHAR},
      mch_name = #{record.mchName,jdbcType=VARCHAR},
      apply_type = #{record.applyType,jdbcType=CHAR},
      mch_status = #{record.mchStatus,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.MchPayInfo">
    update mch_pay_info
    <set>
      <if test="userNumber != null">
        user_number = #{userNumber,jdbcType=INTEGER},
      </if>
      <if test="mcode != null">
        mcode = #{mcode,jdbcType=VARCHAR},
      </if>
      <if test="secretKey != null">
        secret_key = #{secretKey,jdbcType=VARCHAR},
      </if>
      <if test="mchName != null">
        mch_name = #{mchName,jdbcType=VARCHAR},
      </if>
      <if test="applyType != null">
        apply_type = #{applyType,jdbcType=CHAR},
      </if>
      <if test="mchStatus != null">
        mch_status = #{mchStatus,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>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.neusoft.smart.pos.payment.persistent.domain.MchPayInfo">
    update mch_pay_info
    set user_number = #{userNumber,jdbcType=INTEGER},
      mcode = #{mcode,jdbcType=VARCHAR},
      secret_key = #{secretKey,jdbcType=VARCHAR},
      mch_name = #{mchName,jdbcType=VARCHAR},
      apply_type = #{applyType,jdbcType=CHAR},
      mch_status = #{mchStatus,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>
</mapper>