|
@@ -0,0 +1,166 @@
|
|
|
+<?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.ittim.admin.mapper.OauthTokenMapper">
|
|
|
+ <resultMap id="BaseResultMap" type="com.ittim.admin.entity.OauthToken">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ <!--@Table oauth_token-->
|
|
|
+ <id column="token_id" jdbcType="INTEGER" property="tokenId"/>
|
|
|
+ <result column="user_id" jdbcType="VARCHAR" property="userId"/>
|
|
|
+ <result column="access_token" jdbcType="VARCHAR" property="accessToken"/>
|
|
|
+ <result column="refresh_token" jdbcType="VARCHAR" property="refreshToken"/>
|
|
|
+ <result column="expire_time" jdbcType="TIMESTAMP" property="expireTime"/>
|
|
|
+ <result column="refresh_token_expire_time" jdbcType="TIMESTAMP" property="refreshTokenExpireTime"/>
|
|
|
+ <result column="roles" jdbcType="VARCHAR" property="roles"/>
|
|
|
+ <result column="permissions" jdbcType="VARCHAR" property="permissions"/>
|
|
|
+ <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
|
|
+ <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
|
|
+ </resultMap>
|
|
|
+ <sql id="Base_Column_List">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ token_id, user_id, access_token, refresh_token, expire_time, refresh_token_expire_time,
|
|
|
+ roles, permissions, create_time, update_time
|
|
|
+ </sql>
|
|
|
+ <update id="updateBatch" parameterType="java.util.List">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ update oauth_token
|
|
|
+ <trim prefix="set" suffixOverrides=",">
|
|
|
+ <trim prefix="user_id = case" suffix="end,">
|
|
|
+ <foreach collection="list" index="index" item="item">
|
|
|
+ when token_id = #{item.tokenId,jdbcType=INTEGER} then #{item.userId,jdbcType=VARCHAR}
|
|
|
+ </foreach>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="access_token = case" suffix="end,">
|
|
|
+ <foreach collection="list" index="index" item="item">
|
|
|
+ when token_id = #{item.tokenId,jdbcType=INTEGER} then #{item.accessToken,jdbcType=VARCHAR}
|
|
|
+ </foreach>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="refresh_token = case" suffix="end,">
|
|
|
+ <foreach collection="list" index="index" item="item">
|
|
|
+ when token_id = #{item.tokenId,jdbcType=INTEGER} then #{item.refreshToken,jdbcType=VARCHAR}
|
|
|
+ </foreach>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="expire_time = case" suffix="end,">
|
|
|
+ <foreach collection="list" index="index" item="item">
|
|
|
+ when token_id = #{item.tokenId,jdbcType=INTEGER} then #{item.expireTime,jdbcType=TIMESTAMP}
|
|
|
+ </foreach>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="refresh_token_expire_time = case" suffix="end,">
|
|
|
+ <foreach collection="list" index="index" item="item">
|
|
|
+ when token_id = #{item.tokenId,jdbcType=INTEGER} then #{item.refreshTokenExpireTime,jdbcType=TIMESTAMP}
|
|
|
+ </foreach>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="roles = case" suffix="end,">
|
|
|
+ <foreach collection="list" index="index" item="item">
|
|
|
+ when token_id = #{item.tokenId,jdbcType=INTEGER} then #{item.roles,jdbcType=VARCHAR}
|
|
|
+ </foreach>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="permissions = case" suffix="end,">
|
|
|
+ <foreach collection="list" index="index" item="item">
|
|
|
+ when token_id = #{item.tokenId,jdbcType=INTEGER} then #{item.permissions,jdbcType=VARCHAR}
|
|
|
+ </foreach>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="create_time = case" suffix="end,">
|
|
|
+ <foreach collection="list" index="index" item="item">
|
|
|
+ when token_id = #{item.tokenId,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP}
|
|
|
+ </foreach>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="update_time = case" suffix="end,">
|
|
|
+ <foreach collection="list" index="index" item="item">
|
|
|
+ when token_id = #{item.tokenId,jdbcType=INTEGER} then #{item.updateTime,jdbcType=TIMESTAMP}
|
|
|
+ </foreach>
|
|
|
+ </trim>
|
|
|
+ </trim>
|
|
|
+ where token_id in
|
|
|
+ <foreach close=")" collection="list" item="item" open="(" separator=", ">
|
|
|
+ #{item.tokenId,jdbcType=INTEGER}
|
|
|
+ </foreach>
|
|
|
+ </update>
|
|
|
+ <update id="updateBatchSelective" parameterType="java.util.List">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ update oauth_token
|
|
|
+ <trim prefix="set" suffixOverrides=",">
|
|
|
+ <trim prefix="user_id = case" suffix="end,">
|
|
|
+ <foreach collection="list" index="index" item="item">
|
|
|
+ <if test="item.userId != null">
|
|
|
+ when token_id = #{item.tokenId,jdbcType=INTEGER} then #{item.userId,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ </foreach>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="access_token = case" suffix="end,">
|
|
|
+ <foreach collection="list" index="index" item="item">
|
|
|
+ <if test="item.accessToken != null">
|
|
|
+ when token_id = #{item.tokenId,jdbcType=INTEGER} then #{item.accessToken,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ </foreach>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="refresh_token = case" suffix="end,">
|
|
|
+ <foreach collection="list" index="index" item="item">
|
|
|
+ <if test="item.refreshToken != null">
|
|
|
+ when token_id = #{item.tokenId,jdbcType=INTEGER} then #{item.refreshToken,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ </foreach>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="expire_time = case" suffix="end,">
|
|
|
+ <foreach collection="list" index="index" item="item">
|
|
|
+ <if test="item.expireTime != null">
|
|
|
+ when token_id = #{item.tokenId,jdbcType=INTEGER} then #{item.expireTime,jdbcType=TIMESTAMP}
|
|
|
+ </if>
|
|
|
+ </foreach>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="refresh_token_expire_time = case" suffix="end,">
|
|
|
+ <foreach collection="list" index="index" item="item">
|
|
|
+ <if test="item.refreshTokenExpireTime != null">
|
|
|
+ when token_id = #{item.tokenId,jdbcType=INTEGER} then #{item.refreshTokenExpireTime,jdbcType=TIMESTAMP}
|
|
|
+ </if>
|
|
|
+ </foreach>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="roles = case" suffix="end,">
|
|
|
+ <foreach collection="list" index="index" item="item">
|
|
|
+ <if test="item.roles != null">
|
|
|
+ when token_id = #{item.tokenId,jdbcType=INTEGER} then #{item.roles,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ </foreach>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="permissions = case" suffix="end,">
|
|
|
+ <foreach collection="list" index="index" item="item">
|
|
|
+ <if test="item.permissions != null">
|
|
|
+ when token_id = #{item.tokenId,jdbcType=INTEGER} then #{item.permissions,jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ </foreach>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="create_time = case" suffix="end,">
|
|
|
+ <foreach collection="list" index="index" item="item">
|
|
|
+ <if test="item.createTime != null">
|
|
|
+ when token_id = #{item.tokenId,jdbcType=INTEGER} then #{item.createTime,jdbcType=TIMESTAMP}
|
|
|
+ </if>
|
|
|
+ </foreach>
|
|
|
+ </trim>
|
|
|
+ <trim prefix="update_time = case" suffix="end,">
|
|
|
+ <foreach collection="list" index="index" item="item">
|
|
|
+ <if test="item.updateTime != null">
|
|
|
+ when token_id = #{item.tokenId,jdbcType=INTEGER} then #{item.updateTime,jdbcType=TIMESTAMP}
|
|
|
+ </if>
|
|
|
+ </foreach>
|
|
|
+ </trim>
|
|
|
+ </trim>
|
|
|
+ where token_id in
|
|
|
+ <foreach close=")" collection="list" item="item" open="(" separator=", ">
|
|
|
+ #{item.tokenId,jdbcType=INTEGER}
|
|
|
+ </foreach>
|
|
|
+ </update>
|
|
|
+ <insert id="batchInsert" keyColumn="token_id" keyProperty="tokenId" parameterType="map" useGeneratedKeys="true">
|
|
|
+ <!--@mbg.generated-->
|
|
|
+ insert into oauth_token
|
|
|
+ (user_id, access_token, refresh_token, expire_time, refresh_token_expire_time, roles,
|
|
|
+ permissions, create_time, update_time)
|
|
|
+ values
|
|
|
+ <foreach collection="list" item="item" separator=",">
|
|
|
+ (#{item.userId,jdbcType=VARCHAR}, #{item.accessToken,jdbcType=VARCHAR},
|
|
|
+ #{item.refreshToken,jdbcType=VARCHAR},
|
|
|
+ #{item.expireTime,jdbcType=TIMESTAMP}, #{item.refreshTokenExpireTime,jdbcType=TIMESTAMP},
|
|
|
+ #{item.roles,jdbcType=VARCHAR}, #{item.permissions,jdbcType=VARCHAR},
|
|
|
+ #{item.createTime,jdbcType=TIMESTAMP},
|
|
|
+ #{item.updateTime,jdbcType=TIMESTAMP})
|
|
|
+ </foreach>
|
|
|
+ </insert>
|
|
|
+</mapper>
|