<?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="resources/permission.WbUserMapper">
  <resultMap id="BaseResultMap" type="com.wb.permission.pojo.WbUser">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <id column="USER_ID" jdbcType="VARCHAR" property="userId" />
    <result column="TENANCY_ID" jdbcType="VARCHAR" property="tenancyId" />
    <result column="USER_NAME" jdbcType="VARCHAR" property="userName" />
    <result column="DISPLAY_NAME" jdbcType="VARCHAR" property="displayName" />
    <result column="PASSWORD" jdbcType="VARCHAR" property="password" />
    <result column="STATUS" jdbcType="DECIMAL" property="status" />
    <result column="CREATE_DATE" jdbcType="TIMESTAMP" property="createDate" />
    <result column="LOGIN_TIMES" jdbcType="DECIMAL" property="loginTimes" />
    <result column="EMAIL" jdbcType="VARCHAR" property="email" />
    <result column="USE_LANG" jdbcType="VARCHAR" property="useLang" />
    <result column="LAST_LOGIN" jdbcType="TIMESTAMP" property="lastLogin" />
    <result column="DEPT_ID" jdbcType="VARCHAR" property="deptId" />
    <result column="GROUP_CODE" jdbcType="VARCHAR" property="groupCode" />
    <result column="SUPER_FLAG" jdbcType="VARCHAR" property="superFlag" />
    <result column="NOTES" jdbcType="VARCHAR" property="notes" />
    <result column="CREATED_BY" jdbcType="VARCHAR" property="createdBy" />
    <result column="CREATED_ON" jdbcType="TIMESTAMP" property="createdOn" />
    <result column="UPDATED_BY" jdbcType="VARCHAR" property="updatedBy" />
    <result column="UPDATED_ON" jdbcType="TIMESTAMP" property="updatedOn" />
  </resultMap>
  <sql id="Base_Column_List">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    USER_ID, TENANCY_ID, USER_NAME, DISPLAY_NAME, PASSWORD, STATUS, CREATE_DATE, LOGIN_TIMES, 
    EMAIL, USE_LANG, LAST_LOGIN, DEPT_ID, GROUP_CODE, SUPER_FLAG, NOTES, CREATED_BY, 
    CREATED_ON, UPDATED_BY, UPDATED_ON
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select 
    <include refid="Base_Column_List" />
    from WB_USER
    where USER_ID = #{userId,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from WB_USER
    where USER_ID = #{userId,jdbcType=VARCHAR}
  </delete>
  <insert id="insert" parameterType="com.wb.permission.pojo.WbUser">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into WB_USER (USER_ID, TENANCY_ID, USER_NAME, 
      DISPLAY_NAME, PASSWORD, STATUS, 
      CREATE_DATE, LOGIN_TIMES, EMAIL, 
      USE_LANG, LAST_LOGIN, DEPT_ID, 
      GROUP_CODE, SUPER_FLAG, NOTES, 
      CREATED_BY, CREATED_ON, UPDATED_BY, 
      UPDATED_ON)
    values (#{userId,jdbcType=VARCHAR}, #{tenancyId,jdbcType=VARCHAR}, #{userName,jdbcType=VARCHAR}, 
      #{displayName,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{status,jdbcType=DECIMAL}, 
      #{createDate,jdbcType=TIMESTAMP}, #{loginTimes,jdbcType=DECIMAL}, #{email,jdbcType=VARCHAR}, 
      #{useLang,jdbcType=VARCHAR}, #{lastLogin,jdbcType=TIMESTAMP}, #{deptId,jdbcType=VARCHAR}, 
      #{groupCode,jdbcType=VARCHAR}, #{superFlag,jdbcType=VARCHAR}, #{notes,jdbcType=VARCHAR}, 
      #{createdBy,jdbcType=VARCHAR}, #{createdOn,jdbcType=TIMESTAMP}, #{updatedBy,jdbcType=VARCHAR}, 
      #{updatedOn,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="com.wb.permission.pojo.WbUser">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into WB_USER
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="userId != null">
        USER_ID,
      </if>
      <if test="tenancyId != null">
        TENANCY_ID,
      </if>
      <if test="userName != null">
        USER_NAME,
      </if>
      <if test="displayName != null">
        DISPLAY_NAME,
      </if>
      <if test="password != null">
        PASSWORD,
      </if>
      <if test="status != null">
        STATUS,
      </if>
      <if test="createDate != null">
        CREATE_DATE,
      </if>
      <if test="loginTimes != null">
        LOGIN_TIMES,
      </if>
      <if test="email != null">
        EMAIL,
      </if>
      <if test="useLang != null">
        USE_LANG,
      </if>
      <if test="lastLogin != null">
        LAST_LOGIN,
      </if>
      <if test="deptId != null">
        DEPT_ID,
      </if>
      <if test="groupCode != null">
        GROUP_CODE,
      </if>
      <if test="superFlag != null">
        SUPER_FLAG,
      </if>
      <if test="notes != null">
        NOTES,
      </if>
      <if test="createdBy != null">
        CREATED_BY,
      </if>
      <if test="createdOn != null">
        CREATED_ON,
      </if>
      <if test="updatedBy != null">
        UPDATED_BY,
      </if>
      <if test="updatedOn != null">
        UPDATED_ON,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="userId != null">
        #{userId,jdbcType=VARCHAR},
      </if>
      <if test="tenancyId != null">
        #{tenancyId,jdbcType=VARCHAR},
      </if>
      <if test="userName != null">
        #{userName,jdbcType=VARCHAR},
      </if>
      <if test="displayName != null">
        #{displayName,jdbcType=VARCHAR},
      </if>
      <if test="password != null">
        #{password,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        #{status,jdbcType=DECIMAL},
      </if>
      <if test="createDate != null">
        #{createDate,jdbcType=TIMESTAMP},
      </if>
      <if test="loginTimes != null">
        #{loginTimes,jdbcType=DECIMAL},
      </if>
      <if test="email != null">
        #{email,jdbcType=VARCHAR},
      </if>
      <if test="useLang != null">
        #{useLang,jdbcType=VARCHAR},
      </if>
      <if test="lastLogin != null">
        #{lastLogin,jdbcType=TIMESTAMP},
      </if>
      <if test="deptId != null">
        #{deptId,jdbcType=VARCHAR},
      </if>
      <if test="groupCode != null">
        #{groupCode,jdbcType=VARCHAR},
      </if>
      <if test="superFlag != null">
        #{superFlag,jdbcType=VARCHAR},
      </if>
      <if test="notes != null">
        #{notes,jdbcType=VARCHAR},
      </if>
      <if test="createdBy != null">
        #{createdBy,jdbcType=VARCHAR},
      </if>
      <if test="createdOn != null">
        #{createdOn,jdbcType=TIMESTAMP},
      </if>
      <if test="updatedBy != null">
        #{updatedBy,jdbcType=VARCHAR},
      </if>
      <if test="updatedOn != null">
        #{updatedOn,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.wb.permission.pojo.WbUser">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update WB_USER
    <set>
      <if test="tenancyId != null">
        TENANCY_ID = #{tenancyId,jdbcType=VARCHAR},
      </if>
      <if test="userName != null">
        USER_NAME = #{userName,jdbcType=VARCHAR},
      </if>
      <if test="displayName != null">
        DISPLAY_NAME = #{displayName,jdbcType=VARCHAR},
      </if>
      <if test="password != null">
        PASSWORD = #{password,jdbcType=VARCHAR},
      </if>
      <if test="status != null">
        STATUS = #{status,jdbcType=DECIMAL},
      </if>
      <if test="createDate != null">
        CREATE_DATE = #{createDate,jdbcType=TIMESTAMP},
      </if>
      <if test="loginTimes != null">
        LOGIN_TIMES = #{loginTimes,jdbcType=DECIMAL},
      </if>
      <if test="email != null">
        EMAIL = #{email,jdbcType=VARCHAR},
      </if>
      <if test="useLang != null">
        USE_LANG = #{useLang,jdbcType=VARCHAR},
      </if>
      <if test="lastLogin != null">
        LAST_LOGIN = #{lastLogin,jdbcType=TIMESTAMP},
      </if>
      <if test="deptId != null">
        DEPT_ID = #{deptId,jdbcType=VARCHAR},
      </if>
      <if test="groupCode != null">
        GROUP_CODE = #{groupCode,jdbcType=VARCHAR},
      </if>
      <if test="superFlag != null">
        SUPER_FLAG = #{superFlag,jdbcType=VARCHAR},
      </if>
      <if test="notes != null">
        NOTES = #{notes,jdbcType=VARCHAR},
      </if>
      <if test="createdBy != null">
        CREATED_BY = #{createdBy,jdbcType=VARCHAR},
      </if>
      <if test="createdOn != null">
        CREATED_ON = #{createdOn,jdbcType=TIMESTAMP},
      </if>
      <if test="updatedBy != null">
        UPDATED_BY = #{updatedBy,jdbcType=VARCHAR},
      </if>
      <if test="updatedOn != null">
        UPDATED_ON = #{updatedOn,jdbcType=TIMESTAMP},
      </if>
    </set>
    where USER_ID = #{userId,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.wb.permission.pojo.WbUser">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update WB_USER
    set TENANCY_ID = #{tenancyId,jdbcType=VARCHAR},
      USER_NAME = #{userName,jdbcType=VARCHAR},
      DISPLAY_NAME = #{displayName,jdbcType=VARCHAR},
      PASSWORD = #{password,jdbcType=VARCHAR},
      STATUS = #{status,jdbcType=DECIMAL},
      CREATE_DATE = #{createDate,jdbcType=TIMESTAMP},
      LOGIN_TIMES = #{loginTimes,jdbcType=DECIMAL},
      EMAIL = #{email,jdbcType=VARCHAR},
      USE_LANG = #{useLang,jdbcType=VARCHAR},
      LAST_LOGIN = #{lastLogin,jdbcType=TIMESTAMP},
      DEPT_ID = #{deptId,jdbcType=VARCHAR},
      GROUP_CODE = #{groupCode,jdbcType=VARCHAR},
      SUPER_FLAG = #{superFlag,jdbcType=VARCHAR},
      NOTES = #{notes,jdbcType=VARCHAR},
      CREATED_BY = #{createdBy,jdbcType=VARCHAR},
      CREATED_ON = #{createdOn,jdbcType=TIMESTAMP},
      UPDATED_BY = #{updatedBy,jdbcType=VARCHAR},
      UPDATED_ON = #{updatedOn,jdbcType=TIMESTAMP}
    where USER_ID = #{userId,jdbcType=VARCHAR}
  </update>

  <!--查询用户信息-->
  <select id="selectWbUser" parameterType="com.wb.permission.pojo.WbUser" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from WB_USER
    where TENANCY_ID = #{tenancyId,jdbcType=VARCHAR} AND USER_NAME = #{userName,jdbcType=VARCHAR}
    <if test="userId != null">
      AND USER_ID <![CDATA[<>]]>  #{userId,jdbcType=VARCHAR}
    </if>
  </select>
</mapper>