USERSMapper.xml 8.2 KB
<?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.tianbo.warehouse.dao.USERSMapper" >
  <resultMap id="BaseResultMap" type="com.tianbo.warehouse.model.USERS" >
    <id column="user_id" property="userId" jdbcType="INTEGER" />
    <result column="username" property="username" jdbcType="VARCHAR" />
    <result column="password" property="password" jdbcType="VARCHAR" />
    <result column="birthday" property="birthday" jdbcType="TIMESTAMP" />
    <result column="sex" property="sex" jdbcType="CHAR" />
    <result column="address" property="address" jdbcType="VARCHAR" />
    <result column="state" property="state" jdbcType="BIT" />
    <result column="mobilePhone" property="mobilephone" jdbcType="VARCHAR" />
    <result column="creatTime" property="creattime" jdbcType="TIMESTAMP" />
    <result column="updateTime" property="updatetime" jdbcType="TIMESTAMP" />
    <result column="userFace" property="userface" jdbcType="VARCHAR" />
    <result column="realName" property="realname" jdbcType="VARCHAR" />
    <result column="email" property="email" jdbcType="VARCHAR" />
    <result column="age" property="age" jdbcType="INTEGER" />
  </resultMap>
  <resultMap id="SecurityResult" type="com.tianbo.warehouse.model.USERS">
    <id column="user_id" property="userId" jdbcType="INTEGER" />
    <result column="username" property="username" jdbcType="VARCHAR" />
    <result column="birthday" property="birthday" jdbcType="TIMESTAMP" />
    <result column="sex" property="sex" jdbcType="CHAR" />
    <result column="address" property="address" jdbcType="VARCHAR" />
    <result column="state" property="state" jdbcType="BIT" />
    <result column="mobilePhone" property="mobilephone" jdbcType="VARCHAR" />
    <result column="userFace" property="userface" jdbcType="VARCHAR" />
    <result column="realName" property="realname" jdbcType="VARCHAR" />
    <result column="email" property="email" jdbcType="VARCHAR" />
    <result column="age" property="age" jdbcType="INTEGER" />
  </resultMap>
  <sql id="Base_Column_List" >
    user_id, username, password, birthday, sex, address, state, mobilePhone, creatTime,
    updateTime, userFace, realName, email, age
  </sql>
  <sql id="user_List" >
    user_id, username, birthday, sex, address, state, mobilePhone,userFace, realName, email, age
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from users
    where user_id = #{userId,jdbcType=INTEGER}
  </select>
  <select id="selectByUsername" resultMap="BaseResultMap" parameterType="java.lang.String" >
    select
    <include refid="Base_Column_List" />
    from users
    where username = #{username,jdbcType=VARCHAR}
  </select>
  <select id="selectAllUser" resultMap="BaseResultMap" parameterType="com.tianbo.warehouse.model.USERS" >
    select
    *
    from users
    WHERE  1=1
    <if test=" username != null" >
     and  username = #{username,jdbcType=VARCHAR}
    </if>
    <if test="realname != null" >
      and realName = #{realname,jdbcType=VARCHAR}
    </if>
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from users
    where user_id = #{userId,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.tianbo.warehouse.model.USERS" >
    insert into users (user_id, username, password, 
      birthday, sex, address, 
      state, mobilePhone, creatTime, 
      updateTime, userFace, realName,
      email, age)
    values (#{userId,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, 
      #{birthday,jdbcType=TIMESTAMP}, #{sex,jdbcType=CHAR}, #{address,jdbcType=VARCHAR}, 
      #{state,jdbcType=BIT}, #{mobilephone,jdbcType=VARCHAR}, #{creattime,jdbcType=TIMESTAMP}, 
      #{updatetime,jdbcType=TIMESTAMP}, #{userface,jdbcType=VARCHAR}, #{realname,jdbcType=VARCHAR},
      #{email,jdbcType=VARCHAR}, #{age,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="com.tianbo.warehouse.model.USERS" >
    insert into users
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="userId != null" >
        user_id,
      </if>
      <if test="username != null" >
        username,
      </if>
      <if test="password != null" >
        password,
      </if>
      <if test="birthday != null" >
        birthday,
      </if>
      <if test="sex != null" >
        sex,
      </if>
      <if test="address != null" >
        address,
      </if>
      <if test="state != null" >
        state,
      </if>
      <if test="mobilephone != null" >
        mobilePhone,
      </if>
      <if test="creattime != null" >
        creatTime,
      </if>
      <if test="updatetime != null" >
        updateTime,
      </if>
      <if test="userface != null" >
        userFace,
      </if>
      <if test="realname != null" >
        realname,
      </if>
      <if test="email != null" >
        email,
      </if>
      <if test="age != null" >
        age,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="userId != null" >
        #{userId,jdbcType=INTEGER},
      </if>
      <if test="username != null" >
        #{username,jdbcType=VARCHAR},
      </if>
      <if test="password != null" >
        #{password,jdbcType=VARCHAR},
      </if>
      <if test="birthday != null" >
        #{birthday,jdbcType=TIMESTAMP},
      </if>
      <if test="sex != null" >
        #{sex,jdbcType=CHAR},
      </if>
      <if test="address != null" >
        #{address,jdbcType=VARCHAR},
      </if>
      <if test="state != null" >
        #{state,jdbcType=BIT},
      </if>
      <if test="mobilephone != null" >
        #{mobilephone,jdbcType=VARCHAR},
      </if>
      <if test="creattime != null" >
        #{creattime,jdbcType=TIMESTAMP},
      </if>
      <if test="updatetime != null" >
        #{updatetime,jdbcType=TIMESTAMP},
      </if>
      <if test="userface != null" >
        #{userface,jdbcType=VARCHAR},
      </if>
      <if test="realname != null" >
        #{realname,jdbcType=VARCHAR},
      </if>
      <if test="email != null" >
        #{email,jdbcType=VARCHAR},
      </if>
      <if test="age != null" >
        #{age,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.tianbo.warehouse.model.USERS" >
    update users
    <set >
      <if test="password != null" >
        password = #{password,jdbcType=VARCHAR},
      </if>
      <if test="birthday != null" >
        birthday = #{birthday,jdbcType=TIMESTAMP},
      </if>
      <if test="sex != null" >
        sex = #{sex,jdbcType=CHAR},
      </if>
      <if test="address != null" >
        address = #{address,jdbcType=VARCHAR},
      </if>
      <if test="state != null" >
        state = #{state,jdbcType=BIT},
      </if>
      <if test="mobilephone != null" >
        mobilePhone = #{mobilephone,jdbcType=VARCHAR},
      </if>
      <if test="creattime != null" >
        creatTime = #{creattime,jdbcType=TIMESTAMP},
      </if>
      <if test="updatetime != null" >
        updateTime = #{updatetime,jdbcType=TIMESTAMP},
      </if>
      <if test="userface != null" >
        userFace = #{userface,jdbcType=VARCHAR},
      </if>
      <if test="realname != null" >
        realname = #{realname,jdbcType=VARCHAR},
      </if>
      <if test="email != null" >
        email = #{email,jdbcType=VARCHAR},
      </if>
      <if test="age != null" >
        age = #{age,jdbcType=INTEGER},
      </if>
    </set>
    where user_id = #{userId,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.tianbo.warehouse.model.USERS" >
    update users
    set password = #{password,jdbcType=VARCHAR},
      birthday = #{birthday,jdbcType=TIMESTAMP},
      sex = #{sex,jdbcType=CHAR},
      address = #{address,jdbcType=VARCHAR},
      state = #{state,jdbcType=BIT},
      mobilePhone = #{mobilephone,jdbcType=VARCHAR},
      creatTime = #{creattime,jdbcType=TIMESTAMP},
      updateTime = #{updatetime,jdbcType=TIMESTAMP},
      userFace = #{userface,jdbcType=VARCHAR},
      realName = #{realname,jdbcType=VARCHAR},
      email = #{email,jdbcType=VARCHAR},
      age = #{age,jdbcType=INTEGER}
    where user_id = #{userId,jdbcType=INTEGER}
  </update>
</mapper>