<?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.xmomen.module.user.entity.mapper.SysUsersMapper" >
  <resultMap id="BaseResultMap" type="com.xmomen.module.user.entity.SysUsers" >
    <id column="ID" property="id" jdbcType="INTEGER" />
    <result column="USERNAME" property="username" jdbcType="VARCHAR" />
    <result column="REALNAME" property="realname" jdbcType="VARCHAR" />
    <result column="SALT" property="salt" jdbcType="VARCHAR" />
    <result column="PASSWORD" property="password" jdbcType="VARCHAR" />
    <result column="AGE" property="age" jdbcType="INTEGER" />
    <result column="SEX" property="sex" jdbcType="INTEGER" />
    <result column="EMAIL" property="email" jdbcType="VARCHAR" />
    <result column="QQ" property="qq" jdbcType="VARCHAR" />
    <result column="PHONE_NUMBER" property="phoneNumber" jdbcType="VARCHAR" />
    <result column="OFFICE_TEL" property="officeTel" jdbcType="VARCHAR" />
    <result column="LOCKED" property="locked" jdbcType="INTEGER" />
  </resultMap>
  <sql id="Example_Where_Clause" >
    <where >
      <foreach collection="oredCriteria" item="criteria" separator="or" >
        <if test="criteria.valid" >
          <trim prefix="(" suffix=")" prefixOverrides="and" >
            <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 collection="criterion.value" item="listItem" open="(" close=")" 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="(" suffix=")" prefixOverrides="and" >
            <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 collection="criterion.value" item="listItem" open="(" close=")" separator="," >
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List" >
    ID, USERNAME, REALNAME, SALT, PASSWORD, AGE, SEX, EMAIL, QQ, PHONE_NUMBER, OFFICE_TEL, 
    LOCKED
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.xmomen.module.user.entity.SysUsersExample" >
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from sys_users
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null" >
      order by ${orderByClause}
    </if>
  </select>
  <delete id="deleteByExample" parameterType="com.xmomen.module.user.entity.SysUsersExample" >
    delete from sys_users
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insertSelective" parameterType="com.xmomen.module.user.entity.SysUsers" useGeneratedKeys="true" keyProperty="id" keyColumn="ID" >
    insert into sys_users
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        ID,
      </if>
      <if test="username != null" >
        USERNAME,
      </if>
      <if test="realname != null" >
        REALNAME,
      </if>
      <if test="salt != null" >
        SALT,
      </if>
      <if test="password != null" >
        PASSWORD,
      </if>
      <if test="age != null" >
        AGE,
      </if>
      <if test="sex != null" >
        SEX,
      </if>
      <if test="email != null" >
        EMAIL,
      </if>
      <if test="qq != null" >
        QQ,
      </if>
      <if test="phoneNumber != null" >
        PHONE_NUMBER,
      </if>
      <if test="officeTel != null" >
        OFFICE_TEL,
      </if>
      <if test="locked != null" >
        LOCKED,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="username != null" >
        #{username,jdbcType=VARCHAR},
      </if>
      <if test="realname != null" >
        #{realname,jdbcType=VARCHAR},
      </if>
      <if test="salt != null" >
        #{salt,jdbcType=VARCHAR},
      </if>
      <if test="password != null" >
        #{password,jdbcType=VARCHAR},
      </if>
      <if test="age != null" >
        #{age,jdbcType=INTEGER},
      </if>
      <if test="sex != null" >
        #{sex,jdbcType=INTEGER},
      </if>
      <if test="email != null" >
        #{email,jdbcType=VARCHAR},
      </if>
      <if test="qq != null" >
        #{qq,jdbcType=VARCHAR},
      </if>
      <if test="phoneNumber != null" >
        #{phoneNumber,jdbcType=VARCHAR},
      </if>
      <if test="officeTel != null" >
        #{officeTel,jdbcType=VARCHAR},
      </if>
      <if test="locked != null" >
        #{locked,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.xmomen.module.user.entity.SysUsersExample" resultType="java.lang.Integer" >
    select count(*) from sys_users
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update sys_users
    <set >
      <if test="record.id != null" >
        ID = #{record.id,jdbcType=INTEGER},
      </if>
      <if test="record.username != null" >
        USERNAME = #{record.username,jdbcType=VARCHAR},
      </if>
      <if test="record.realname != null" >
        REALNAME = #{record.realname,jdbcType=VARCHAR},
      </if>
      <if test="record.salt != null" >
        SALT = #{record.salt,jdbcType=VARCHAR},
      </if>
      <if test="record.password != null" >
        PASSWORD = #{record.password,jdbcType=VARCHAR},
      </if>
      <if test="record.age != null" >
        AGE = #{record.age,jdbcType=INTEGER},
      </if>
      <if test="record.sex != null" >
        SEX = #{record.sex,jdbcType=INTEGER},
      </if>
      <if test="record.email != null" >
        EMAIL = #{record.email,jdbcType=VARCHAR},
      </if>
      <if test="record.qq != null" >
        QQ = #{record.qq,jdbcType=VARCHAR},
      </if>
      <if test="record.phoneNumber != null" >
        PHONE_NUMBER = #{record.phoneNumber,jdbcType=VARCHAR},
      </if>
      <if test="record.officeTel != null" >
        OFFICE_TEL = #{record.officeTel,jdbcType=VARCHAR},
      </if>
      <if test="record.locked != null" >
        LOCKED = #{record.locked,jdbcType=INTEGER},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
</mapper>