USERSMapper.xml 8.3 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.sunyo.energy.location.dao.USERSMapper">
    <resultMap id="BaseResultMap" type="com.sunyo.energy.location.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"/>
        <result column="company_id" property="companyId" jdbcType="INTEGER"/>
    </resultMap>
    <sql id="Base_Column_List">
    user_id, username, password, birthday, sex, address, state, mobilePhone, creatTime, 
    updateTime, userFace, realName, email, age, company_id
  </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>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from users
    where user_id = #{userId,jdbcType=INTEGER}
  </delete>
    <insert id="insert" parameterType="com.sunyo.energy.location.model.USERS">
    insert into users (user_id, username, password, 
      birthday, sex, address, 
      state, mobilePhone, creatTime, 
      updateTime, userFace, realName, 
      email, age, company_id
      )
    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}, #{companyId,jdbcType=INTEGER}
      )
  </insert>
    <insert id="insertSelective" parameterType="com.sunyo.energy.location.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>
            <if test="companyId != null">
                company_id,
            </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>
            <if test="companyId != null">
                #{companyId,jdbcType=INTEGER},
            </if>
        </trim>
    </insert>
    <update id="updateByPrimaryKeySelective" parameterType="com.sunyo.energy.location.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="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>
            <if test="companyId != null">
                company_id = #{companyId,jdbcType=INTEGER},
            </if>
        </set>
        where user_id = #{userId,jdbcType=INTEGER}
    </update>
    <update id="updateByPrimaryKey" parameterType="com.sunyo.energy.location.model.USERS">
    update users
    set username = #{username,jdbcType=VARCHAR},
      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},
      company_id = #{companyId,jdbcType=INTEGER}
    where user_id = #{userId,jdbcType=INTEGER}
  </update>
</mapper>