<?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.boco.nbd.wios.manage.mapper.def.UserMapper">
  <resultMap id="BaseResultMap" type="com.boco.nbd.wios.manage.entity.bo.User">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="account" jdbcType="VARCHAR" property="account" />
    <result column="password" jdbcType="VARCHAR" property="password" />
    <result column="password_salt" jdbcType="VARCHAR" property="passwordSalt" />
    <result column="open_id" jdbcType="VARCHAR" property="openId" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="email" jdbcType="VARCHAR" property="email" />
    <result column="nick_name" jdbcType="VARCHAR" property="nickName" />
    <result column="head_img" jdbcType="VARCHAR" property="headImg" />
    <result column="status" jdbcType="INTEGER" property="status" />
    <result column="amount" jdbcType="DECIMAL" property="amount" />
    <result column="last_login_time" jdbcType="TIMESTAMP" property="lastLoginTime" />
    <result column="create_account" jdbcType="VARCHAR" property="createAccount" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="modify_account" jdbcType="VARCHAR" property="modifyAccount" />
    <result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime" />
  </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, account, password, password_salt, open_id, name, email, nick_name, head_img, 
    status, amount, last_login_time, create_account, create_time, modify_account, modify_time
  </sql>
  <select id="selectByExample" parameterType="com.boco.nbd.wios.manage.entity.bo.UserCriteria" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from t_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.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from t_user
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from t_user
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <delete id="deleteByExample" parameterType="com.boco.nbd.wios.manage.entity.bo.UserCriteria">
    delete from t_user
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.boco.nbd.wios.manage.entity.bo.User">
    insert into t_user (id, account, password, 
      password_salt, open_id, name, 
      email, nick_name, head_img, 
      status, amount, last_login_time, 
      create_account, create_time, modify_account, 
      modify_time)
    values (#{id,jdbcType=INTEGER}, #{account,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, 
      #{passwordSalt,jdbcType=VARCHAR}, #{openId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, 
      #{email,jdbcType=VARCHAR}, #{nickName,jdbcType=VARCHAR}, #{headImg,jdbcType=VARCHAR}, 
      #{status,jdbcType=INTEGER}, #{amount,jdbcType=DECIMAL}, #{lastLoginTime,jdbcType=TIMESTAMP}, 
      #{createAccount,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{modifyAccount,jdbcType=VARCHAR}, 
      #{modifyTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="com.boco.nbd.wios.manage.entity.bo.User">
    insert into t_user
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="account != null">
        account,
      </if>
      <if test="password != null">
        password,
      </if>
      <if test="passwordSalt != null">
        password_salt,
      </if>
      <if test="openId != null">
        open_id,
      </if>
      <if test="name != null">
        name,
      </if>
      <if test="email != null">
        email,
      </if>
      <if test="nickName != null">
        nick_name,
      </if>
      <if test="headImg != null">
        head_img,
      </if>
      <if test="status != null">
        status,
      </if>
      <if test="amount != null">
        amount,
      </if>
      <if test="lastLoginTime != null">
        last_login_time,
      </if>
      <if test="createAccount != null">
        create_account,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="modifyAccount != null">
        modify_account,
      </if>
      <if test="modifyTime != null">
        modify_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="account != null">
        #{account,jdbcType=VARCHAR},
      </if>
      <if test="password != null">
        #{password,jdbcType=VARCHAR},
      </if>
      <if test="passwordSalt != null">
        #{passwordSalt,jdbcType=VARCHAR},
      </if>
      <if test="openId != null">
        #{openId,jdbcType=VARCHAR},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="email != null">
        #{email,jdbcType=VARCHAR},
      </if>
      <if test="nickName != null">
        #{nickName,jdbcType=VARCHAR},
      </if>
      <if test="headImg != null">
        #{headImg,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        #{status,jdbcType=INTEGER},
      </if>
      <if test="amount != null">
        #{amount,jdbcType=DECIMAL},
      </if>
      <if test="lastLoginTime != null">
        #{lastLoginTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createAccount != null">
        #{createAccount,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="modifyAccount != null">
        #{modifyAccount,jdbcType=VARCHAR},
      </if>
      <if test="modifyTime != null">
        #{modifyTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.boco.nbd.wios.manage.entity.bo.UserCriteria" resultType="java.lang.Long">
    select count(*) from t_user
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update t_user
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=INTEGER},
      </if>
      <if test="record.account != null">
        account = #{record.account,jdbcType=VARCHAR},
      </if>
      <if test="record.password != null">
        password = #{record.password,jdbcType=VARCHAR},
      </if>
      <if test="record.passwordSalt != null">
        password_salt = #{record.passwordSalt,jdbcType=VARCHAR},
      </if>
      <if test="record.openId != null">
        open_id = #{record.openId,jdbcType=VARCHAR},
      </if>
      <if test="record.name != null">
        name = #{record.name,jdbcType=VARCHAR},
      </if>
      <if test="record.email != null">
        email = #{record.email,jdbcType=VARCHAR},
      </if>
      <if test="record.nickName != null">
        nick_name = #{record.nickName,jdbcType=VARCHAR},
      </if>
      <if test="record.headImg != null">
        head_img = #{record.headImg,jdbcType=VARCHAR},
      </if>
      <if test="record.status != null">
        status = #{record.status,jdbcType=INTEGER},
      </if>
      <if test="record.amount != null">
        amount = #{record.amount,jdbcType=DECIMAL},
      </if>
      <if test="record.lastLoginTime != null">
        last_login_time = #{record.lastLoginTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.createAccount != null">
        create_account = #{record.createAccount,jdbcType=VARCHAR},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.modifyAccount != null">
        modify_account = #{record.modifyAccount,jdbcType=VARCHAR},
      </if>
      <if test="record.modifyTime != null">
        modify_time = #{record.modifyTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update t_user
    set id = #{record.id,jdbcType=INTEGER},
      account = #{record.account,jdbcType=VARCHAR},
      password = #{record.password,jdbcType=VARCHAR},
      password_salt = #{record.passwordSalt,jdbcType=VARCHAR},
      open_id = #{record.openId,jdbcType=VARCHAR},
      name = #{record.name,jdbcType=VARCHAR},
      email = #{record.email,jdbcType=VARCHAR},
      nick_name = #{record.nickName,jdbcType=VARCHAR},
      head_img = #{record.headImg,jdbcType=VARCHAR},
      status = #{record.status,jdbcType=INTEGER},
      amount = #{record.amount,jdbcType=DECIMAL},
      last_login_time = #{record.lastLoginTime,jdbcType=TIMESTAMP},
      create_account = #{record.createAccount,jdbcType=VARCHAR},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      modify_account = #{record.modifyAccount,jdbcType=VARCHAR},
      modify_time = #{record.modifyTime,jdbcType=TIMESTAMP}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.boco.nbd.wios.manage.entity.bo.User">
    update t_user
    <set>
      <if test="account != null">
        account = #{account,jdbcType=VARCHAR},
      </if>
      <if test="password != null">
        password = #{password,jdbcType=VARCHAR},
      </if>
      <if test="passwordSalt != null">
        password_salt = #{passwordSalt,jdbcType=VARCHAR},
      </if>
      <if test="openId != null">
        open_id = #{openId,jdbcType=VARCHAR},
      </if>
      <if test="name != null">
        name = #{name,jdbcType=VARCHAR},
      </if>
      <if test="email != null">
        email = #{email,jdbcType=VARCHAR},
      </if>
      <if test="nickName != null">
        nick_name = #{nickName,jdbcType=VARCHAR},
      </if>
      <if test="headImg != null">
        head_img = #{headImg,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        status = #{status,jdbcType=INTEGER},
      </if>
      <if test="amount != null">
        amount = #{amount,jdbcType=DECIMAL},
      </if>
      <if test="lastLoginTime != null">
        last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createAccount != null">
        create_account = #{createAccount,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="modifyAccount != null">
        modify_account = #{modifyAccount,jdbcType=VARCHAR},
      </if>
      <if test="modifyTime != null">
        modify_time = #{modifyTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.boco.nbd.wios.manage.entity.bo.User">
    update t_user
    set account = #{account,jdbcType=VARCHAR},
      password = #{password,jdbcType=VARCHAR},
      password_salt = #{passwordSalt,jdbcType=VARCHAR},
      open_id = #{openId,jdbcType=VARCHAR},
      name = #{name,jdbcType=VARCHAR},
      email = #{email,jdbcType=VARCHAR},
      nick_name = #{nickName,jdbcType=VARCHAR},
      head_img = #{headImg,jdbcType=VARCHAR},
      status = #{status,jdbcType=INTEGER},
      amount = #{amount,jdbcType=DECIMAL},
      last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP},
      create_account = #{createAccount,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      modify_account = #{modifyAccount,jdbcType=VARCHAR},
      modify_time = #{modifyTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=INTEGER}
  </update>


  <select id="list" parameterType="com.boco.nbd.wios.manage.entity.bo.User" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from t_user u
    <where>
      <if test="id!=null">
        u.id = #{id}
      </if>
      <if test="account!=null and account!=''">
        u.account = #{account}
      </if>
      <if test="openId!=null and openId!=''">
        u.open_id = #{openId}
      </if>
      <if test="status!=null">
        u.status = #{status}
      </if>
      order by u.create_time
    </where>
  </select>

  <select id="count" parameterType="com.boco.nbd.wios.manage.entity.bo.User" resultType="java.lang.Integer">
    select count(*)
    from t_user u
    <where>
      <if test="id!=null">
        u.id = #{id}
      </if>
      <if test="account!=null and account!=''">
        u.account = #{account}
      </if>
      <if test="openId!=null and openId!=''">
        u.open_id = #{openId}
      </if>
      <if test="status!=null">
        u.status = #{status}
      </if>
    </where>
  </select>
</mapper>