<?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="cn.superdesk.uniorder.dao.mapper.sys.SysOderUserMapper">
  <resultMap id="BaseResultMap" type="cn.superdesk.uniorder.dao.entity.sys.SysOderUser">

    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="user_id" jdbcType="BIGINT" property="userId" />
    <result column="realname" jdbcType="VARCHAR" property="realname" />
    <result column="mobile" jdbcType="VARCHAR" property="mobile" />
    <result column="bill_email" jdbcType="VARCHAR" property="billEmail" />
    <result column="sync_time" jdbcType="TIMESTAMP" property="syncTime" />
    <result column="other_field1" jdbcType="VARCHAR" property="otherField1" />
    <result column="other_field2" jdbcType="VARCHAR" property="otherField2" />
    <result column="other_field3" jdbcType="VARCHAR" property="otherField3" />
    <result column="enterprise_id" jdbcType="BIGINT" property="enterpriseId" />
    <result column="organization_id" jdbcType="BIGINT" property="organizationId" />
    <result column="fund_balance" jdbcType="DECIMAL" property="fundBalance" />
  </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_id, realname, mobile, bill_email, sync_time, other_field1, other_field2, 
    other_field3, enterprise_id, organization_id, fund_balance
  </sql>
  <select id="selectByExample" parameterType="cn.superdesk.uniorder.dao.entity.sys.SysOderUserExample" resultMap="BaseResultMap">

    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from sys_oder_user
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
  <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">

    select 
    <include refid="Base_Column_List" />
    from sys_oder_user
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">

    delete from sys_oder_user
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="cn.superdesk.uniorder.dao.entity.sys.SysOderUserExample">

    delete from sys_oder_user
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="cn.superdesk.uniorder.dao.entity.sys.SysOderUser">

    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into sys_oder_user (user_id, realname, mobile, 
      bill_email, sync_time, other_field1, 
      other_field2, other_field3, enterprise_id, 
      organization_id, fund_balance)
    values (#{userId,jdbcType=BIGINT}, #{realname,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, 
      #{billEmail,jdbcType=VARCHAR}, #{syncTime,jdbcType=TIMESTAMP}, #{otherField1,jdbcType=VARCHAR}, 
      #{otherField2,jdbcType=VARCHAR}, #{otherField3,jdbcType=VARCHAR}, #{enterpriseId,jdbcType=BIGINT}, 
      #{organizationId,jdbcType=BIGINT}, #{fundBalance,jdbcType=DECIMAL})
  </insert>
  <insert id="insertSelective" parameterType="cn.superdesk.uniorder.dao.entity.sys.SysOderUser">

    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into sys_oder_user
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="userId != null">
        user_id,
      </if>
      <if test="realname != null">
        realname,
      </if>
      <if test="mobile != null">
        mobile,
      </if>
      <if test="billEmail != null">
        bill_email,
      </if>
      <if test="syncTime != null">
        sync_time,
      </if>
      <if test="otherField1 != null">
        other_field1,
      </if>
      <if test="otherField2 != null">
        other_field2,
      </if>
      <if test="otherField3 != null">
        other_field3,
      </if>
      <if test="enterpriseId != null">
        enterprise_id,
      </if>
      <if test="organizationId != null">
        organization_id,
      </if>
      <if test="fundBalance != null">
        fund_balance,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="userId != null">
        #{userId,jdbcType=BIGINT},
      </if>
      <if test="realname != null">
        #{realname,jdbcType=VARCHAR},
      </if>
      <if test="mobile != null">
        #{mobile,jdbcType=VARCHAR},
      </if>
      <if test="billEmail != null">
        #{billEmail,jdbcType=VARCHAR},
      </if>
      <if test="syncTime != null">
        #{syncTime,jdbcType=TIMESTAMP},
      </if>
      <if test="otherField1 != null">
        #{otherField1,jdbcType=VARCHAR},
      </if>
      <if test="otherField2 != null">
        #{otherField2,jdbcType=VARCHAR},
      </if>
      <if test="otherField3 != null">
        #{otherField3,jdbcType=VARCHAR},
      </if>
      <if test="enterpriseId != null">
        #{enterpriseId,jdbcType=BIGINT},
      </if>
      <if test="organizationId != null">
        #{organizationId,jdbcType=BIGINT},
      </if>
      <if test="fundBalance != null">
        #{fundBalance,jdbcType=DECIMAL},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="cn.superdesk.uniorder.dao.entity.sys.SysOderUserExample" resultType="java.lang.Long">

    select count(*) from sys_oder_user
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">

    update sys_oder_user
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.userId != null">
        user_id = #{record.userId,jdbcType=BIGINT},
      </if>
      <if test="record.realname != null">
        realname = #{record.realname,jdbcType=VARCHAR},
      </if>
      <if test="record.mobile != null">
        mobile = #{record.mobile,jdbcType=VARCHAR},
      </if>
      <if test="record.billEmail != null">
        bill_email = #{record.billEmail,jdbcType=VARCHAR},
      </if>
      <if test="record.syncTime != null">
        sync_time = #{record.syncTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.otherField1 != null">
        other_field1 = #{record.otherField1,jdbcType=VARCHAR},
      </if>
      <if test="record.otherField2 != null">
        other_field2 = #{record.otherField2,jdbcType=VARCHAR},
      </if>
      <if test="record.otherField3 != null">
        other_field3 = #{record.otherField3,jdbcType=VARCHAR},
      </if>
      <if test="record.enterpriseId != null">
        enterprise_id = #{record.enterpriseId,jdbcType=BIGINT},
      </if>
      <if test="record.organizationId != null">
        organization_id = #{record.organizationId,jdbcType=BIGINT},
      </if>
      <if test="record.fundBalance != null">
        fund_balance = #{record.fundBalance,jdbcType=DECIMAL},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">

    update sys_oder_user
    set id = #{record.id,jdbcType=BIGINT},
      user_id = #{record.userId,jdbcType=BIGINT},
      realname = #{record.realname,jdbcType=VARCHAR},
      mobile = #{record.mobile,jdbcType=VARCHAR},
      bill_email = #{record.billEmail,jdbcType=VARCHAR},
      sync_time = #{record.syncTime,jdbcType=TIMESTAMP},
      other_field1 = #{record.otherField1,jdbcType=VARCHAR},
      other_field2 = #{record.otherField2,jdbcType=VARCHAR},
      other_field3 = #{record.otherField3,jdbcType=VARCHAR},
      enterprise_id = #{record.enterpriseId,jdbcType=BIGINT},
      organization_id = #{record.organizationId,jdbcType=BIGINT},
      fund_balance = #{record.fundBalance,jdbcType=DECIMAL}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="cn.superdesk.uniorder.dao.entity.sys.SysOderUser">

    update sys_oder_user
    <set>
      <if test="userId != null">
        user_id = #{userId,jdbcType=BIGINT},
      </if>
      <if test="realname != null">
        realname = #{realname,jdbcType=VARCHAR},
      </if>
      <if test="mobile != null">
        mobile = #{mobile,jdbcType=VARCHAR},
      </if>
      <if test="billEmail != null">
        bill_email = #{billEmail,jdbcType=VARCHAR},
      </if>
      <if test="syncTime != null">
        sync_time = #{syncTime,jdbcType=TIMESTAMP},
      </if>
      <if test="otherField1 != null">
        other_field1 = #{otherField1,jdbcType=VARCHAR},
      </if>
      <if test="otherField2 != null">
        other_field2 = #{otherField2,jdbcType=VARCHAR},
      </if>
      <if test="otherField3 != null">
        other_field3 = #{otherField3,jdbcType=VARCHAR},
      </if>
      <if test="enterpriseId != null">
        enterprise_id = #{enterpriseId,jdbcType=BIGINT},
      </if>
      <if test="organizationId != null">
        organization_id = #{organizationId,jdbcType=BIGINT},
      </if>
      <if test="fundBalance != null">
        fund_balance = #{fundBalance,jdbcType=DECIMAL},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="cn.superdesk.uniorder.dao.entity.sys.SysOderUser">

    update sys_oder_user
    set user_id = #{userId,jdbcType=BIGINT},
      realname = #{realname,jdbcType=VARCHAR},
      mobile = #{mobile,jdbcType=VARCHAR},
      bill_email = #{billEmail,jdbcType=VARCHAR},
      sync_time = #{syncTime,jdbcType=TIMESTAMP},
      other_field1 = #{otherField1,jdbcType=VARCHAR},
      other_field2 = #{otherField2,jdbcType=VARCHAR},
      other_field3 = #{otherField3,jdbcType=VARCHAR},
      enterprise_id = #{enterpriseId,jdbcType=BIGINT},
      organization_id = #{organizationId,jdbcType=BIGINT},
      fund_balance = #{fundBalance,jdbcType=DECIMAL}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>