UsersMapper.xml 10.8 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.mapper.UsersMapper" >
  <resultMap id="BaseResultMap" type="com.tianbo.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="Example_Where_Clause" >
    <where >
      <foreach collection="oredCriteria" item="criteria" separator="or" >
        <if test="criteria.valid" >
          <trim prefix="(" suffix=")" prefixOverrides="and" >
            <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 collection="criterion.value" item="listItem" open="(" close=")" 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="(" suffix=")" prefixOverrides="and" >
            <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 collection="criterion.value" item="listItem" open="(" close=")" separator="," >
                    #{listItem}
                  </foreach>
                </when>
              </choose>
            </foreach>
          </trim>
        </if>
      </foreach>
    </where>
  </sql>
  <sql id="Base_Column_List" >
    USER_ID, USERNAME, PASSWORD, STATE, CREATTIME, SEX, ADDRESS, BIRTHDAY, MOBILEPHONE, 
    UPDATETIME
  </sql>
  <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.tianbo.model.UsersExample" >
    <include refid="OracleDialectPrefix" />
    select
    <if test="distinct" >
      distinct
    </if>
    <include refid="Base_Column_List" />
    from USERS
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
    <if test="orderByClause != null" >
      order by ${orderByClause}
    </if>
    <include refid="OracleDialectSuffix" />
  </select>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.math.BigDecimal" >
    select 
    <include refid="Base_Column_List" />
    from USERS
    where USER_ID = #{userId,jdbcType=DECIMAL}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.math.BigDecimal" >
    delete from USERS
    where USER_ID = #{userId,jdbcType=DECIMAL}
  </delete>
  <delete id="deleteByExample" parameterType="com.tianbo.model.UsersExample" >
    delete from USERS
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </delete>
  <insert id="insert" parameterType="com.tianbo.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.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>
  <select id="countByExample" parameterType="com.tianbo.model.UsersExample" resultType="java.lang.Integer" >
    select count(*) from USERS
    <if test="_parameter != null" >
      <include refid="Example_Where_Clause" />
    </if>
  </select>
  <update id="updateByExampleSelective" parameterType="map" >
    update USERS
    <set >
      <if test="record.userId != null" >
        USER_ID = #{record.userId,jdbcType=DECIMAL},
      </if>
      <if test="record.username != null" >
        USERNAME = #{record.username,jdbcType=VARCHAR},
      </if>
      <if test="record.password != null" >
        PASSWORD = #{record.password,jdbcType=VARCHAR},
      </if>
      <if test="record.state != null" >
        STATE = #{record.state,jdbcType=DECIMAL},
      </if>
      <if test="record.creattime != null" >
        CREATTIME = #{record.creattime,jdbcType=TIMESTAMP},
      </if>
      <if test="record.sex != null" >
        SEX = #{record.sex,jdbcType=VARCHAR},
      </if>
      <if test="record.address != null" >
        ADDRESS = #{record.address,jdbcType=VARCHAR},
      </if>
      <if test="record.birthday != null" >
        BIRTHDAY = #{record.birthday,jdbcType=TIMESTAMP},
      </if>
      <if test="record.mobilephone != null" >
        MOBILEPHONE = #{record.mobilephone,jdbcType=VARCHAR},
      </if>
      <if test="record.updatetime != null" >
        UPDATETIME = #{record.updatetime,jdbcType=TIMESTAMP},
      </if>
    </set>
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByExample" parameterType="map" >
    update USERS
    set USER_ID = #{record.userId,jdbcType=DECIMAL},
      USERNAME = #{record.username,jdbcType=VARCHAR},
      PASSWORD = #{record.password,jdbcType=VARCHAR},
      STATE = #{record.state,jdbcType=DECIMAL},
      CREATTIME = #{record.creattime,jdbcType=TIMESTAMP},
      SEX = #{record.sex,jdbcType=VARCHAR},
      ADDRESS = #{record.address,jdbcType=VARCHAR},
      BIRTHDAY = #{record.birthday,jdbcType=TIMESTAMP},
      MOBILEPHONE = #{record.mobilephone,jdbcType=VARCHAR},
      UPDATETIME = #{record.updatetime,jdbcType=TIMESTAMP}
    <if test="_parameter != null" >
      <include refid="Update_By_Example_Where_Clause" />
    </if>
  </update>
  <update id="updateByPrimaryKeySelective" parameterType="com.tianbo.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.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>
  <sql id="OracleDialectPrefix" >
    <if test="page != null" >
      select * from ( select row_.*, rownum rownum_ from ( 
    </if>
  </sql>
  <sql id="OracleDialectSuffix" >
    <if test="page != null" >
      <![CDATA[ ) row_ ) where rownum_ > #{page.begin} and rownum_ <= #{page.end} ]]>
    </if>
  </sql>
</mapper>