<?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.microservices.wiki.mapper.sys.TokenMapper">
    <resultMap id="BaseResultMap" type="com.microservices.wiki.domain.sys.Token">
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="user_id" property="userId" jdbcType="INTEGER" />
    <result column="action" property="action" jdbcType="VARCHAR" />
    <result column="value" property="value" jdbcType="VARCHAR" />
    <result column="created_on" property="createdOn" 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="Base_Column_List" >
    id, user_id, action, value, created_on
  </sql>
  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from tokens
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from tokens
    where id = #{id,jdbcType=INTEGER}
  </delete>
    <insert id="insert" parameterType="com.microservices.wiki.domain.sys.Token">
    insert into tokens (id, user_id, action, 
      value, created_on)
    values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{action,jdbcType=VARCHAR}, 
      #{value,jdbcType=VARCHAR}, #{createdOn,jdbcType=TIMESTAMP})
  </insert>
    <insert id="insertSelective" parameterType="com.microservices.wiki.domain.sys.Token">
    insert into tokens
    <trim prefix="(" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        id,
      </if>
      <if test="userId != null" >
        user_id,
      </if>
      <if test="action != null" >
        action,
      </if>
      <if test="value != null" >
        value,
      </if>
      <if test="createdOn != null" >
        created_on,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides="," >
      <if test="id != null" >
        #{id,jdbcType=INTEGER},
      </if>
      <if test="userId != null" >
        #{userId,jdbcType=INTEGER},
      </if>
      <if test="action != null" >
        #{action,jdbcType=VARCHAR},
      </if>
      <if test="value != null" >
        #{value,jdbcType=VARCHAR},
      </if>
      <if test="createdOn != null" >
        #{createdOn,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
    <update id="updateByPrimaryKeySelective" parameterType="com.microservices.wiki.domain.sys.Token">
    update tokens
    <set >
      <if test="userId != null" >
        user_id = #{userId,jdbcType=INTEGER},
      </if>
      <if test="action != null" >
        action = #{action,jdbcType=VARCHAR},
      </if>
      <if test="value != null" >
        value = #{value,jdbcType=VARCHAR},
      </if>
      <if test="createdOn != null" >
        created_on = #{createdOn,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
    <update id="updateByPrimaryKey" parameterType="com.microservices.wiki.domain.sys.Token">
    update tokens
    set user_id = #{userId,jdbcType=INTEGER},
      action = #{action,jdbcType=VARCHAR},
      value = #{value,jdbcType=VARCHAR},
      created_on = #{createdOn,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=INTEGER}
  </update>
</mapper>