<?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.SysUserMapper">
  <resultMap id="BaseResultMap" type="cn.superdesk.uniorder.dao.entity.sys.SysUser">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="user_name" jdbcType="VARCHAR" property="userName" />
    <result column="user_password" jdbcType="VARCHAR" property="userPassword" />
    <result column="fullname" jdbcType="VARCHAR" property="fullname" />
    <result column="phone" jdbcType="VARCHAR" property="phone" />
    <result column="role_id" jdbcType="BIGINT" property="roleId" />
    <result column="sys_role_ext_data_id" jdbcType="BIGINT" property="sysRoleExtDataId" />
    <result column="source_from" jdbcType="VARCHAR" property="sourceFrom" />
    <result column="source_from_quote_id" jdbcType="BIGINT" property="sourceFromQuoteId" />
    <result column="personalized_logo" jdbcType="VARCHAR" property="personalizedLogo" />
    <result column="personalized_subhead" jdbcType="VARCHAR" property="personalizedSubhead" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="create_user_id" jdbcType="BIGINT" property="createUserId" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
    <result column="update_user_id" jdbcType="BIGINT" property="updateUserId" />
    <result column="deleted" jdbcType="TINYINT" property="deleted" />
    <result column="enabled" jdbcType="TINYINT" property="enabled" />
  </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_name, user_password, fullname, phone, role_id, sys_role_ext_data_id, source_from,
    source_from_quote_id, personalized_logo, personalized_subhead, create_time, create_user_id,
    update_time, update_user_id, deleted, enabled
  </sql>
  <select id="selectByExample" parameterType="cn.superdesk.uniorder.dao.entity.sys.SysUserExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from sys_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_user
    where id = #{id,jdbcType=BIGINT}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
    delete from sys_user
    where id = #{id,jdbcType=BIGINT}
  </delete>
  <delete id="deleteByExample" parameterType="cn.superdesk.uniorder.dao.entity.sys.SysUserExample">
    delete from sys_user
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="cn.superdesk.uniorder.dao.entity.sys.SysUser">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into sys_user (user_name, user_password, fullname,
      phone, role_id, sys_role_ext_data_id,
      source_from, source_from_quote_id, personalized_logo,
      personalized_subhead, create_time, create_user_id,
      update_time, update_user_id, deleted,
      enabled)
    values (#{userName,jdbcType=VARCHAR}, #{userPassword,jdbcType=VARCHAR}, #{fullname,jdbcType=VARCHAR},
      #{phone,jdbcType=VARCHAR}, #{roleId,jdbcType=BIGINT}, #{sysRoleExtDataId,jdbcType=BIGINT},
      #{sourceFrom,jdbcType=VARCHAR}, #{sourceFromQuoteId,jdbcType=BIGINT}, #{personalizedLogo,jdbcType=VARCHAR},
      #{personalizedSubhead,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{createUserId,jdbcType=BIGINT},
      #{updateTime,jdbcType=TIMESTAMP}, #{updateUserId,jdbcType=BIGINT}, #{deleted,jdbcType=TINYINT},
      #{enabled,jdbcType=TINYINT})
  </insert>
  <insert id="insertSelective" parameterType="cn.superdesk.uniorder.dao.entity.sys.SysUser">
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
    insert into sys_user
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="userName != null">
        user_name,
      </if>
      <if test="userPassword != null">
        user_password,
      </if>
      <if test="fullname != null">
        fullname,
      </if>
      <if test="phone != null">
        phone,
      </if>
      <if test="roleId != null">
        role_id,
      </if>
      <if test="sysRoleExtDataId != null">
        sys_role_ext_data_id,
      </if>
      <if test="sourceFrom != null">
        source_from,
      </if>
      <if test="sourceFromQuoteId != null">
        source_from_quote_id,
      </if>
      <if test="personalizedLogo != null">
        personalized_logo,
      </if>
      <if test="personalizedSubhead != null">
        personalized_subhead,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="createUserId != null">
        create_user_id,
      </if>
      <if test="updateTime != null">
        update_time,
      </if>
      <if test="updateUserId != null">
        update_user_id,
      </if>
      <if test="deleted != null">
        deleted,
      </if>
      <if test="enabled != null">
        enabled,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="userName != null">
        #{userName,jdbcType=VARCHAR},
      </if>
      <if test="userPassword != null">
        #{userPassword,jdbcType=VARCHAR},
      </if>
      <if test="fullname != null">
        #{fullname,jdbcType=VARCHAR},
      </if>
      <if test="phone != null">
        #{phone,jdbcType=VARCHAR},
      </if>
      <if test="roleId != null">
        #{roleId,jdbcType=BIGINT},
      </if>
      <if test="sysRoleExtDataId != null">
        #{sysRoleExtDataId,jdbcType=BIGINT},
      </if>
      <if test="sourceFrom != null">
        #{sourceFrom,jdbcType=VARCHAR},
      </if>
      <if test="sourceFromQuoteId != null">
        #{sourceFromQuoteId,jdbcType=BIGINT},
      </if>
      <if test="personalizedLogo != null">
        #{personalizedLogo,jdbcType=VARCHAR},
      </if>
      <if test="personalizedSubhead != null">
        #{personalizedSubhead,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createUserId != null">
        #{createUserId,jdbcType=BIGINT},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateUserId != null">
        #{updateUserId,jdbcType=BIGINT},
      </if>
      <if test="deleted != null">
        #{deleted,jdbcType=TINYINT},
      </if>
      <if test="enabled != null">
        #{enabled,jdbcType=TINYINT},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="cn.superdesk.uniorder.dao.entity.sys.SysUserExample" resultType="java.lang.Long">
    select count(*) from sys_user
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update sys_user
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=BIGINT},
      </if>
      <if test="record.userName != null">
        user_name = #{record.userName,jdbcType=VARCHAR},
      </if>
      <if test="record.userPassword != null">
        user_password = #{record.userPassword,jdbcType=VARCHAR},
      </if>
      <if test="record.fullname != null">
        fullname = #{record.fullname,jdbcType=VARCHAR},
      </if>
      <if test="record.phone != null">
        phone = #{record.phone,jdbcType=VARCHAR},
      </if>
      <if test="record.roleId != null">
        role_id = #{record.roleId,jdbcType=BIGINT},
      </if>
      <if test="record.sysRoleExtDataId != null">
        sys_role_ext_data_id = #{record.sysRoleExtDataId,jdbcType=BIGINT},
      </if>
      <if test="record.sourceFrom != null">
        source_from = #{record.sourceFrom,jdbcType=VARCHAR},
      </if>
      <if test="record.sourceFromQuoteId != null">
        source_from_quote_id = #{record.sourceFromQuoteId,jdbcType=BIGINT},
      </if>
      <if test="record.personalizedLogo != null">
        personalized_logo = #{record.personalizedLogo,jdbcType=VARCHAR},
      </if>
      <if test="record.personalizedSubhead != null">
        personalized_subhead = #{record.personalizedSubhead,jdbcType=VARCHAR},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.createUserId != null">
        create_user_id = #{record.createUserId,jdbcType=BIGINT},
      </if>
      <if test="record.updateTime != null">
        update_time = #{record.updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.updateUserId != null">
        update_user_id = #{record.updateUserId,jdbcType=BIGINT},
      </if>
      <if test="record.deleted != null">
        deleted = #{record.deleted,jdbcType=TINYINT},
      </if>
      <if test="record.enabled != null">
        enabled = #{record.enabled,jdbcType=TINYINT},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update sys_user
    set id = #{record.id,jdbcType=BIGINT},
      user_name = #{record.userName,jdbcType=VARCHAR},
      user_password = #{record.userPassword,jdbcType=VARCHAR},
      fullname = #{record.fullname,jdbcType=VARCHAR},
      phone = #{record.phone,jdbcType=VARCHAR},
      role_id = #{record.roleId,jdbcType=BIGINT},
      sys_role_ext_data_id = #{record.sysRoleExtDataId,jdbcType=BIGINT},
      source_from = #{record.sourceFrom,jdbcType=VARCHAR},
      source_from_quote_id = #{record.sourceFromQuoteId,jdbcType=BIGINT},
      personalized_logo = #{record.personalizedLogo,jdbcType=VARCHAR},
      personalized_subhead = #{record.personalizedSubhead,jdbcType=VARCHAR},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      create_user_id = #{record.createUserId,jdbcType=BIGINT},
      update_time = #{record.updateTime,jdbcType=TIMESTAMP},
      update_user_id = #{record.updateUserId,jdbcType=BIGINT},
      deleted = #{record.deleted,jdbcType=TINYINT},
      enabled = #{record.enabled,jdbcType=TINYINT}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="cn.superdesk.uniorder.dao.entity.sys.SysUser">
    update sys_user
    <set>
      <if test="userName != null">
        user_name = #{userName,jdbcType=VARCHAR},
      </if>
      <if test="userPassword != null">
        user_password = #{userPassword,jdbcType=VARCHAR},
      </if>
      <if test="fullname != null">
        fullname = #{fullname,jdbcType=VARCHAR},
      </if>
      <if test="phone != null">
        phone = #{phone,jdbcType=VARCHAR},
      </if>
      <if test="roleId != null">
        role_id = #{roleId,jdbcType=BIGINT},
      </if>
      <if test="sysRoleExtDataId != null">
        sys_role_ext_data_id = #{sysRoleExtDataId,jdbcType=BIGINT},
      </if>
      <if test="sourceFrom != null">
        source_from = #{sourceFrom,jdbcType=VARCHAR},
      </if>
      <if test="sourceFromQuoteId != null">
        source_from_quote_id = #{sourceFromQuoteId,jdbcType=BIGINT},
      </if>
      <if test="personalizedLogo != null">
        personalized_logo = #{personalizedLogo,jdbcType=VARCHAR},
      </if>
      <if test="personalizedSubhead != null">
        personalized_subhead = #{personalizedSubhead,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="createUserId != null">
        create_user_id = #{createUserId,jdbcType=BIGINT},
      </if>
      <if test="updateTime != null">
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateUserId != null">
        update_user_id = #{updateUserId,jdbcType=BIGINT},
      </if>
      <if test="deleted != null">
        deleted = #{deleted,jdbcType=TINYINT},
      </if>
      <if test="enabled != null">
        enabled = #{enabled,jdbcType=TINYINT},
      </if>
    </set>
    where id = #{id,jdbcType=BIGINT}
  </update>
  <update id="updateByPrimaryKey" parameterType="cn.superdesk.uniorder.dao.entity.sys.SysUser">
    update sys_user
    set user_name = #{userName,jdbcType=VARCHAR},
      user_password = #{userPassword,jdbcType=VARCHAR},
      fullname = #{fullname,jdbcType=VARCHAR},
      phone = #{phone,jdbcType=VARCHAR},
      role_id = #{roleId,jdbcType=BIGINT},
      sys_role_ext_data_id = #{sysRoleExtDataId,jdbcType=BIGINT},
      source_from = #{sourceFrom,jdbcType=VARCHAR},
      source_from_quote_id = #{sourceFromQuoteId,jdbcType=BIGINT},
      personalized_logo = #{personalizedLogo,jdbcType=VARCHAR},
      personalized_subhead = #{personalizedSubhead,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      create_user_id = #{createUserId,jdbcType=BIGINT},
      update_time = #{updateTime,jdbcType=TIMESTAMP},
      update_user_id = #{updateUserId,jdbcType=BIGINT},
      deleted = #{deleted,jdbcType=TINYINT},
      enabled = #{enabled,jdbcType=TINYINT}
    where id = #{id,jdbcType=BIGINT}
  </update>
</mapper>
