USERSMapper.xml 5.7 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="DECIMAL" />
    <result column="USERNAME" property="username" jdbcType="VARCHAR" />
    <result column="PASSWORD" property="password" jdbcType="VARCHAR" />
    <result column="STATE" property="state" jdbcType="DECIMAL" />
    <result column="CREATTIME" property="creattime" jdbcType="TIMESTAMP" />
    <result column="SEX" property="sex" jdbcType="VARCHAR" />
    <result column="ADDRESS" property="address" jdbcType="VARCHAR" />
    <result column="BIRTHDAY" property="birthday" jdbcType="TIMESTAMP" />
    <result column="MOBILEPHONE" property="mobilephone" jdbcType="VARCHAR" />
    <result column="UPDATETIME" property="updatetime" jdbcType="TIMESTAMP" />
  </resultMap>
  <sql id="Base_Column_List" >
    USER_ID, USERNAME, PASSWORD, STATE, CREATTIME, SEX, ADDRESS, BIRTHDAY, MOBILEPHONE, 
    UPDATETIME
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.math.BigDecimal" >
    select 
    <include refid="Base_Column_List" />
    from USERS
    where USER_ID = #{userId,jdbcType=DECIMAL}
  </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" >
    select
    <include refid="Base_Column_List" />
    from USERS
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal" >
    delete from USERS
    where USER_ID = #{userId,jdbcType=DECIMAL}
  </delete>
  <insert id="insert" parameterType="com.tianbo.warehouse.model.USERS" >
    insert into USERS (USER_ID, USERNAME, PASSWORD, 
      STATE, CREATTIME, SEX, 
      ADDRESS, BIRTHDAY, MOBILEPHONE, 
      UPDATETIME)
    values (#{userId,jdbcType=DECIMAL}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, 
      #{state,jdbcType=DECIMAL}, #{creattime,jdbcType=TIMESTAMP}, #{sex,jdbcType=VARCHAR}, 
      #{address,jdbcType=VARCHAR}, #{birthday,jdbcType=TIMESTAMP}, #{mobilephone,jdbcType=VARCHAR}, 
      #{updatetime,jdbcType=TIMESTAMP})
  </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="state != null" >
        STATE,
      </if>
      <if test="creattime != null" >
        CREATTIME,
      </if>
      <if test="sex != null" >
        SEX,
      </if>
      <if test="address != null" >
        ADDRESS,
      </if>
      <if test="birthday != null" >
        BIRTHDAY,
      </if>
      <if test="mobilephone != null" >
        MOBILEPHONE,
      </if>
      <if test="updatetime != null" >
        UPDATETIME,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="userId != null" >
        #{userId,jdbcType=DECIMAL},
      </if>
      <if test="username != null" >
        #{username,jdbcType=VARCHAR},
      </if>
      <if test="password != null" >
        #{password,jdbcType=VARCHAR},
      </if>
      <if test="state != null" >
        #{state,jdbcType=DECIMAL},
      </if>
      <if test="creattime != null" >
        #{creattime,jdbcType=TIMESTAMP},
      </if>
      <if test="sex != null" >
        #{sex,jdbcType=VARCHAR},
      </if>
      <if test="address != null" >
        #{address,jdbcType=VARCHAR},
      </if>
      <if test="birthday != null" >
        #{birthday,jdbcType=TIMESTAMP},
      </if>
      <if test="mobilephone != null" >
        #{mobilephone,jdbcType=VARCHAR},
      </if>
      <if test="updatetime != null" >
        #{updatetime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.tianbo.warehouse.model.USERS" >
    update USERS
    <set >
      <if test="username != null" >
        USERNAME = #{username,jdbcType=VARCHAR},
      </if>
      <if test="password != null" >
        PASSWORD = #{password,jdbcType=VARCHAR},
      </if>
      <if test="state != null" >
        STATE = #{state,jdbcType=DECIMAL},
      </if>
      <if test="creattime != null" >
        CREATTIME = #{creattime,jdbcType=TIMESTAMP},
      </if>
      <if test="sex != null" >
        SEX = #{sex,jdbcType=VARCHAR},
      </if>
      <if test="address != null" >
        ADDRESS = #{address,jdbcType=VARCHAR},
      </if>
      <if test="birthday != null" >
        BIRTHDAY = #{birthday,jdbcType=TIMESTAMP},
      </if>
      <if test="mobilephone != null" >
        MOBILEPHONE = #{mobilephone,jdbcType=VARCHAR},
      </if>
      <if test="updatetime != null" >
        UPDATETIME = #{updatetime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where USER_ID = #{userId,jdbcType=DECIMAL}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.tianbo.warehouse.model.USERS" >
    update USERS
    set USERNAME = #{username,jdbcType=VARCHAR},
      PASSWORD = #{password,jdbcType=VARCHAR},
      STATE = #{state,jdbcType=DECIMAL},
      CREATTIME = #{creattime,jdbcType=TIMESTAMP},
      SEX = #{sex,jdbcType=VARCHAR},
      ADDRESS = #{address,jdbcType=VARCHAR},
      BIRTHDAY = #{birthday,jdbcType=TIMESTAMP},
      MOBILEPHONE = #{mobilephone,jdbcType=VARCHAR},
      UPDATETIME = #{updatetime,jdbcType=TIMESTAMP}
    where USER_ID = #{userId,jdbcType=DECIMAL}
  </update>
</mapper>