<?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="pwc.taxtech.atms.dao.UserMapper">
  <resultMap id="BaseResultMap" type="pwc.taxtech.atms.entity.User">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="user_name" jdbcType="VARCHAR" property="userName" />
    <result column="email" jdbcType="VARCHAR" property="email" />
    <result column="password" jdbcType="VARCHAR" property="password" />
    <result column="login_type" jdbcType="INTEGER" property="loginType" />
    <result column="status" jdbcType="INTEGER" property="status" />
    <result column="expiration_date" jdbcType="TIMESTAMP" property="expirationDate" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
    <result column="is_admin" jdbcType="BIT" property="isAdmin" />
    <result column="password_update_time" jdbcType="TIMESTAMP" property="passwordUpdateTime" />
    <result column="attempt_times" jdbcType="INTEGER" property="attemptTimes" />
    <result column="locked_time" jdbcType="TIMESTAMP" property="lockedTime" />
    <result column="organization_id" jdbcType="VARCHAR" property="organizationId" />
    <result column="is_super_admin" jdbcType="BIT" property="isSuperAdmin" />
  </resultMap>
  <sql id="Example_Where_Clause">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <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">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    <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">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    id, user_name, email, password, login_type, status, expiration_date, create_time, 
    update_time, is_admin, password_update_time, attempt_times, locked_time, organization_id, 
    is_super_admin
  </sql>
  <select id="selectByExample" parameterType="pwc.taxtech.atms.entity.UserExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from 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.String" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select 
    <include refid="Base_Column_List" />
    from user
    where id = #{id,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 user
    where id = #{id,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="pwc.taxtech.atms.entity.UserExample">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    delete from user
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="pwc.taxtech.atms.entity.User">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into user (id, user_name, email, 
      password, login_type, status, 
      expiration_date, create_time, update_time, 
      is_admin, password_update_time, attempt_times, 
      locked_time, organization_id, is_super_admin
      )
    values (#{id,jdbcType=VARCHAR}, #{userName,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, 
      #{password,jdbcType=VARCHAR}, #{loginType,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, 
      #{expirationDate,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, 
      #{isAdmin,jdbcType=BIT}, #{passwordUpdateTime,jdbcType=TIMESTAMP}, #{attemptTimes,jdbcType=INTEGER}, 
      #{lockedTime,jdbcType=TIMESTAMP}, #{organizationId,jdbcType=VARCHAR}, #{isSuperAdmin,jdbcType=BIT}
      )
  </insert>
  <insert id="insertSelective" parameterType="pwc.taxtech.atms.entity.User">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    insert into user
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="userName != null">
        user_name,
      </if>
      <if test="email != null">
        email,
      </if>
      <if test="password != null">
        password,
      </if>
      <if test="loginType != null">
        login_type,
      </if>
      <if test="status != null">
        status,
      </if>
      <if test="expirationDate != null">
        expiration_date,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="updateTime != null">
        update_time,
      </if>
      <if test="isAdmin != null">
        is_admin,
      </if>
      <if test="passwordUpdateTime != null">
        password_update_time,
      </if>
      <if test="attemptTimes != null">
        attempt_times,
      </if>
      <if test="lockedTime != null">
        locked_time,
      </if>
      <if test="organizationId != null">
        organization_id,
      </if>
      <if test="isSuperAdmin != null">
        is_super_admin,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="userName != null">
        #{userName,jdbcType=VARCHAR},
      </if>
      <if test="email != null">
        #{email,jdbcType=VARCHAR},
      </if>
      <if test="password != null">
        #{password,jdbcType=VARCHAR},
      </if>
      <if test="loginType != null">
        #{loginType,jdbcType=INTEGER},
      </if>
      <if test="status != null">
        #{status,jdbcType=INTEGER},
      </if>
      <if test="expirationDate != null">
        #{expirationDate,jdbcType=TIMESTAMP},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="isAdmin != null">
        #{isAdmin,jdbcType=BIT},
      </if>
      <if test="passwordUpdateTime != null">
        #{passwordUpdateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="attemptTimes != null">
        #{attemptTimes,jdbcType=INTEGER},
      </if>
      <if test="lockedTime != null">
        #{lockedTime,jdbcType=TIMESTAMP},
      </if>
      <if test="organizationId != null">
        #{organizationId,jdbcType=VARCHAR},
      </if>
      <if test="isSuperAdmin != null">
        #{isSuperAdmin,jdbcType=BIT},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="pwc.taxtech.atms.entity.UserExample" resultType="java.lang.Long">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select count(*) from user
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update user
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=VARCHAR},
      </if>
      <if test="record.userName != null">
        user_name = #{record.userName,jdbcType=VARCHAR},
      </if>
      <if test="record.email != null">
        email = #{record.email,jdbcType=VARCHAR},
      </if>
      <if test="record.password != null">
        password = #{record.password,jdbcType=VARCHAR},
      </if>
      <if test="record.loginType != null">
        login_type = #{record.loginType,jdbcType=INTEGER},
      </if>
      <if test="record.status != null">
        status = #{record.status,jdbcType=INTEGER},
      </if>
      <if test="record.expirationDate != null">
        expiration_date = #{record.expirationDate,jdbcType=TIMESTAMP},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.updateTime != null">
        update_time = #{record.updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.isAdmin != null">
        is_admin = #{record.isAdmin,jdbcType=BIT},
      </if>
      <if test="record.passwordUpdateTime != null">
        password_update_time = #{record.passwordUpdateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.attemptTimes != null">
        attempt_times = #{record.attemptTimes,jdbcType=INTEGER},
      </if>
      <if test="record.lockedTime != null">
        locked_time = #{record.lockedTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.organizationId != null">
        organization_id = #{record.organizationId,jdbcType=VARCHAR},
      </if>
      <if test="record.isSuperAdmin != null">
        is_super_admin = #{record.isSuperAdmin,jdbcType=BIT},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update user
    set id = #{record.id,jdbcType=VARCHAR},
      user_name = #{record.userName,jdbcType=VARCHAR},
      email = #{record.email,jdbcType=VARCHAR},
      password = #{record.password,jdbcType=VARCHAR},
      login_type = #{record.loginType,jdbcType=INTEGER},
      status = #{record.status,jdbcType=INTEGER},
      expiration_date = #{record.expirationDate,jdbcType=TIMESTAMP},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      update_time = #{record.updateTime,jdbcType=TIMESTAMP},
      is_admin = #{record.isAdmin,jdbcType=BIT},
      password_update_time = #{record.passwordUpdateTime,jdbcType=TIMESTAMP},
      attempt_times = #{record.attemptTimes,jdbcType=INTEGER},
      locked_time = #{record.lockedTime,jdbcType=TIMESTAMP},
      organization_id = #{record.organizationId,jdbcType=VARCHAR},
      is_super_admin = #{record.isSuperAdmin,jdbcType=BIT}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="pwc.taxtech.atms.entity.User">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update user
    <set>
      <if test="userName != null">
        user_name = #{userName,jdbcType=VARCHAR},
      </if>
      <if test="email != null">
        email = #{email,jdbcType=VARCHAR},
      </if>
      <if test="password != null">
        password = #{password,jdbcType=VARCHAR},
      </if>
      <if test="loginType != null">
        login_type = #{loginType,jdbcType=INTEGER},
      </if>
      <if test="status != null">
        status = #{status,jdbcType=INTEGER},
      </if>
      <if test="expirationDate != null">
        expiration_date = #{expirationDate,jdbcType=TIMESTAMP},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="updateTime != null">
        update_time = #{updateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="isAdmin != null">
        is_admin = #{isAdmin,jdbcType=BIT},
      </if>
      <if test="passwordUpdateTime != null">
        password_update_time = #{passwordUpdateTime,jdbcType=TIMESTAMP},
      </if>
      <if test="attemptTimes != null">
        attempt_times = #{attemptTimes,jdbcType=INTEGER},
      </if>
      <if test="lockedTime != null">
        locked_time = #{lockedTime,jdbcType=TIMESTAMP},
      </if>
      <if test="organizationId != null">
        organization_id = #{organizationId,jdbcType=VARCHAR},
      </if>
      <if test="isSuperAdmin != null">
        is_super_admin = #{isSuperAdmin,jdbcType=BIT},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="pwc.taxtech.atms.entity.User">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    update user
    set user_name = #{userName,jdbcType=VARCHAR},
      email = #{email,jdbcType=VARCHAR},
      password = #{password,jdbcType=VARCHAR},
      login_type = #{loginType,jdbcType=INTEGER},
      status = #{status,jdbcType=INTEGER},
      expiration_date = #{expirationDate,jdbcType=TIMESTAMP},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      update_time = #{updateTime,jdbcType=TIMESTAMP},
      is_admin = #{isAdmin,jdbcType=BIT},
      password_update_time = #{passwordUpdateTime,jdbcType=TIMESTAMP},
      attempt_times = #{attemptTimes,jdbcType=INTEGER},
      locked_time = #{lockedTime,jdbcType=TIMESTAMP},
      organization_id = #{organizationId,jdbcType=VARCHAR},
      is_super_admin = #{isSuperAdmin,jdbcType=BIT}
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <select id="selectByExampleWithRowbounds" parameterType="pwc.taxtech.atms.entity.UserExample" resultMap="BaseResultMap">
    <!--
      WARNING - @mbg.generated
      This element is automatically generated by MyBatis Generator, do not modify.
    -->
    select
    <if test="distinct">
      distinct
    </if>
    <include refid="Base_Column_List" />
    from user
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null">
      order by ${orderByClause}
    </if>
  </select>
</mapper>