<?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.pengzu.dao.SysUserDao">
  <resultMap id="BaseResultMap" type="com.pengzu.entity.SysUser">
    <id column="id" jdbcType="VARCHAR" property="id" />
    <result column="nick_name" jdbcType="VARCHAR" property="nickName" />
    <result column="username" jdbcType="VARCHAR" property="username" />
    <result column="email" jdbcType="VARCHAR" property="email" />
    <result column="address" jdbcType="VARCHAR" property="address" />
    <result column="sex" jdbcType="VARCHAR" property="sex" />
    <result column="idcard" jdbcType="VARCHAR" property="idcard" />
    <result column="phone" jdbcType="VARCHAR" property="phone" />
    <result column="password" jdbcType="VARCHAR" property="password" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="last_login_time" jdbcType="TIMESTAMP" property="lastLoginTime" />
    <result column="status" jdbcType="TINYINT" property="status" />
    <result column="create_name_id" jdbcType="VARCHAR" property="createNameId" />
    <result column="is_delete" jdbcType="INTEGER" property="isDelete" />
  </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, nick_name, username , email, address, sex, idcard, phone, password, create_time, last_login_time,
    status, create_name_id, is_delete
  </sql>
  <select id="selectByExample" parameterType="com.pengzu.entity.SysUserExample" resultMap="BaseResultMap">
    select
    <if test="distinct">
      distinct
    </if>
    'true' as QUERYID,
    <include refid="Base_Column_List" />
    from pengzucms.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.String" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from pengzucms.sys_user
    where id = #{id,jdbcType=VARCHAR}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
    delete from pengzucms.sys_user
    where id = #{id,jdbcType=VARCHAR}
  </delete>
  <delete id="deleteByExample" parameterType="com.pengzu.entity.SysUserExample">
    delete from pengzucms.sys_user
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.pengzu.entity.SysUser">
    insert into pengzucms.sys_user (id, nick_name, username, email, address,
      sex, idcard, phone, 
      password, create_time, last_login_time, 
      status, create_name_id, is_delete
      )
    values (#{id,jdbcType=VARCHAR}, #{nickName,jdbcType=VARCHAR}, #{username,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR},
      #{sex,jdbcType=VARCHAR}, #{idcard,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, 
      #{password,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{lastLoginTime,jdbcType=TIMESTAMP}, 
      #{status,jdbcType=TINYINT}, #{createNameId,jdbcType=VARCHAR}, #{isDelete,jdbcType=INTEGER}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.pengzu.entity.SysUser">
    insert into pengzucms.sys_user
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="nickName != null">
        nick_name,
      </if>
      <if test="username != null">
        username,
      </if>
      <if test="email != null">
        email,
      </if>
      <if test="address != null">
        address,
      </if>
      <if test="sex != null">
        sex,
      </if>
      <if test="idcard != null">
        idcard,
      </if>
      <if test="phone != null">
        phone,
      </if>
      <if test="password != null">
        password,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="lastLoginTime != null">
        last_login_time,
      </if>
      <if test="status != null">
        status,
      </if>
      <if test="createNameId != null">
        create_name_id,
      </if>
      <if test="isDelete != null">
        is_delete,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=VARCHAR},
      </if>
      <if test="nickName != null">
        #{nickName,jdbcType=VARCHAR},
      </if>
      <if test="username != null">
        #{username,jdbcType=VARCHAR},
      </if>
      <if test="email != null">
        #{email,jdbcType=VARCHAR},
      </if>
      <if test="address != null">
        #{address,jdbcType=VARCHAR},
      </if>
      <if test="sex != null">
        #{sex,jdbcType=VARCHAR},
      </if>
      <if test="idcard != null">
        #{idcard,jdbcType=VARCHAR},
      </if>
      <if test="phone != null">
        #{phone,jdbcType=VARCHAR},
      </if>
      <if test="password != null">
        #{password,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="lastLoginTime != null">
        #{lastLoginTime,jdbcType=TIMESTAMP},
      </if>
      <if test="status != null">
        #{status,jdbcType=TINYINT},
      </if>
      <if test="createNameId != null">
        #{createNameId,jdbcType=VARCHAR},
      </if>
      <if test="isDelete != null">
        #{isDelete,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <select id="countByExample" parameterType="com.pengzu.entity.SysUserExample" resultType="java.lang.Long">
    select count(*) from pengzucms.sys_user
    <if test="_parameter != null">
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map">
    update pengzucms.sys_user
    <set>
      <if test="record.id != null">
        id = #{record.id,jdbcType=VARCHAR},
      </if>
      <if test="record.nickName != null">
        nick_name = #{record.nickName,jdbcType=VARCHAR},
      </if>
      <if test="record.username != null">
        username = #{record.username,jdbcType=VARCHAR},
      </if>
      <if test="record.email != null">
        email = #{record.email,jdbcType=VARCHAR},
      </if>
      <if test="record.address != null">
        address = #{record.address,jdbcType=VARCHAR},
      </if>
      <if test="record.sex != null">
        sex = #{record.sex,jdbcType=VARCHAR},
      </if>
      <if test="record.idcard != null">
        idcard = #{record.idcard,jdbcType=VARCHAR},
      </if>
      <if test="record.phone != null">
        phone = #{record.phone,jdbcType=VARCHAR},
      </if>
      <if test="record.password != null">
        password = #{record.password,jdbcType=VARCHAR},
      </if>
      <if test="record.createTime != null">
        create_time = #{record.createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.lastLoginTime != null">
        last_login_time = #{record.lastLoginTime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.status != null">
        status = #{record.status,jdbcType=TINYINT},
      </if>
      <if test="record.createNameId != null">
        create_name_id = #{record.createNameId,jdbcType=VARCHAR},
      </if>
      <if test="record.isDelete != null">
        is_delete = #{record.isDelete,jdbcType=INTEGER},
      </if>
    </set>
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map">
    update pengzucms.sys_user
    set id = #{record.id,jdbcType=VARCHAR},
      nick_name = #{record.nickName,jdbcType=VARCHAR},
      username = #{record.username,jdbcType=VARCHAR},
      email = #{record.email,jdbcType=VARCHAR},
      address = #{record.address,jdbcType=VARCHAR},
      sex = #{record.sex,jdbcType=VARCHAR},
      idcard = #{record.idcard,jdbcType=VARCHAR},
      phone = #{record.phone,jdbcType=VARCHAR},
      password = #{record.password,jdbcType=VARCHAR},
      create_time = #{record.createTime,jdbcType=TIMESTAMP},
      last_login_time = #{record.lastLoginTime,jdbcType=TIMESTAMP},
      status = #{record.status,jdbcType=TINYINT},
      create_name_id = #{record.createNameId,jdbcType=VARCHAR},
      is_delete = #{record.isDelete,jdbcType=INTEGER}
    <if test="_parameter != null">
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.pengzu.entity.SysUser">
    update pengzucms.sys_user
    <set>
      <if test="nickName != null">
        nick_name = #{nickName,jdbcType=VARCHAR},
      </if>
      <if test="username != null">
        username = #{username,jdbcType=VARCHAR},
      </if>
      <if test="email != null">
        email = #{email,jdbcType=VARCHAR},
      </if>
      <if test="address != null">
        address = #{address,jdbcType=VARCHAR},
      </if>
      <if test="sex != null">
        sex = #{sex,jdbcType=VARCHAR},
      </if>
      <if test="idcard != null">
        idcard = #{idcard,jdbcType=VARCHAR},
      </if>
      <if test="phone != null">
        phone = #{phone,jdbcType=VARCHAR},
      </if>
      <if test="password != null">
        password = #{password,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="lastLoginTime != null">
        last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP},
      </if>
      <if test="status != null">
        status = #{status,jdbcType=TINYINT},
      </if>
      <if test="createNameId != null">
        create_name_id = #{createNameId,jdbcType=VARCHAR},
      </if>
      <if test="isDelete != null">
        is_delete = #{isDelete,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=VARCHAR}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.pengzu.entity.SysUser">
    update pengzucms.sys_user
    set nick_name = #{nickName,jdbcType=VARCHAR},
      username = #{username,jdbcType=VARCHAR},
      email = #{email,jdbcType=VARCHAR},
      address = #{address,jdbcType=VARCHAR},
      sex = #{sex,jdbcType=VARCHAR},
      idcard = #{idcard,jdbcType=VARCHAR},
      phone = #{phone,jdbcType=VARCHAR},
      password = #{password,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP},
      status = #{status,jdbcType=TINYINT},
      create_name_id = #{createNameId,jdbcType=VARCHAR},
      is_delete = #{isDelete,jdbcType=INTEGER}
    where id = #{id,jdbcType=VARCHAR}
  </update>
</mapper>