<?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.FumaoUserInfoMapper">
  <resultMap id="BaseResultMap" type="com.neusoft.smart.pos.payment.persistent.domain.FumaoUserInfo">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="tenant_id" jdbcType="VARCHAR" property="tenantId" />
    <result column="merchant_id" jdbcType="VARCHAR" property="merchantId" />
    <result column="order_operator_phone" jdbcType="VARCHAR" property="orderOperatorPhone" />
    <result column="order_operator_id" jdbcType="VARCHAR" property="orderOperatorId" />
    <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, tenant_id, merchant_id, order_operator_phone, order_operator_id, updated_at
  </sql>
  <select id="selectByExample" parameterType="com.neusoft.smart.pos.payment.persistent.domain.FumaoUserInfoExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from fumao_user_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 fumao_user_info
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from fumao_user_info
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="com.neusoft.smart.pos.payment.persistent.domain.FumaoUserInfoExample">
    delete from fumao_user_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.FumaoUserInfo" useGeneratedKeys="true">
    insert into fumao_user_info (tenant_id, merchant_id, order_operator_phone, 
      order_operator_id, updated_at)
    values (#{tenantId,jdbcType=VARCHAR}, #{merchantId,jdbcType=VARCHAR}, #{orderOperatorPhone,jdbcType=VARCHAR}, 
      #{orderOperatorId,jdbcType=VARCHAR}, #{updatedAt,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.neusoft.smart.pos.payment.persistent.domain.FumaoUserInfo" useGeneratedKeys="true">
    insert into fumao_user_info
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="tenantId != null">
        tenant_id,
      </if>
      <if test="merchantId != null">
        merchant_id,
      </if>
      <if test="orderOperatorPhone != null">
        order_operator_phone,
      </if>
      <if test="orderOperatorId != null">
        order_operator_id,
      </if>
      <if test="updatedAt != null">
        updated_at,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="tenantId != null">
        #{tenantId,jdbcType=VARCHAR},
      </if>
      <if test="merchantId != null">
        #{merchantId,jdbcType=VARCHAR},
      </if>
      <if test="orderOperatorPhone != null">
        #{orderOperatorPhone,jdbcType=VARCHAR},
      </if>
      <if test="orderOperatorId != null">
        #{orderOperatorId,jdbcType=VARCHAR},
      </if>
      <if test="updatedAt != null">
        #{updatedAt,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.neusoft.smart.pos.payment.persistent.domain.FumaoUserInfoExample" resultType="java.lang.Integer">
    select count(*) from fumao_user_info
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update fumao_user_info
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=INTEGER},
      </if>
      <if test="record.tenantId != null">
        tenant_id = #{record.tenantId,jdbcType=VARCHAR},
      </if>
      <if test="record.merchantId != null">
        merchant_id = #{record.merchantId,jdbcType=VARCHAR},
      </if>
      <if test="record.orderOperatorPhone != null">
        order_operator_phone = #{record.orderOperatorPhone,jdbcType=VARCHAR},
      </if>
      <if test="record.orderOperatorId != null">
        order_operator_id = #{record.orderOperatorId,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 fumao_user_info
    set id = #{record.id,jdbcType=INTEGER},
      tenant_id = #{record.tenantId,jdbcType=VARCHAR},
      merchant_id = #{record.merchantId,jdbcType=VARCHAR},
      order_operator_phone = #{record.orderOperatorPhone,jdbcType=VARCHAR},
      order_operator_id = #{record.orderOperatorId,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.FumaoUserInfo">
    update fumao_user_info
    <set>
      <if test="tenantId != null">
        tenant_id = #{tenantId,jdbcType=VARCHAR},
      </if>
      <if test="merchantId != null">
        merchant_id = #{merchantId,jdbcType=VARCHAR},
      </if>
      <if test="orderOperatorPhone != null">
        order_operator_phone = #{orderOperatorPhone,jdbcType=VARCHAR},
      </if>
      <if test="orderOperatorId != null">
        order_operator_id = #{orderOperatorId,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.FumaoUserInfo">
    update fumao_user_info
    set tenant_id = #{tenantId,jdbcType=VARCHAR},
      merchant_id = #{merchantId,jdbcType=VARCHAR},
      order_operator_phone = #{orderOperatorPhone,jdbcType=VARCHAR},
      order_operator_id = #{orderOperatorId,jdbcType=VARCHAR},
      updated_at = #{updatedAt,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <insert id="batchInsert">
    <if test="items.get(0) != null">
            insert into fumao_user_info  (tenant_id, merchant_id, order_operator_phone, 
        order_operator_id, updated_at)
      values
      <foreach collection="items" item="item" index="index" separator=",">
      (#{item.tenantId,jdbcType=VARCHAR}, #{item.merchantId,jdbcType=VARCHAR}, #{item.orderOperatorPhone,jdbcType=VARCHAR}, 
        #{item.orderOperatorId,jdbcType=VARCHAR}, #{item.updatedAt,jdbcType=TIMESTAMP})
      </foreach>
    </if>
  </insert>
</mapper>