1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "mybatis-3-mapper.dtd">
-
- <mapper namespace="org.sonar.db.user.SessionTokenMapper">
-
- <sql id="columns">
- st.uuid as uuid,
- st.user_uuid as "userUuid",
- st.expiration_date as "expirationDate",
- st.created_at as "createdAt",
- st.updated_at as "updatedAt"
- </sql>
-
- <select id="selectByUuid" parameterType="String" resultType="org.sonar.db.user.SessionTokenDto">
- select
- <include refid="columns"/>
- from session_tokens st
- where st.uuid=#{uuid, jdbcType=VARCHAR}
- </select>
-
- <insert id="insert" parameterType="Map" useGeneratedKeys="false">
- insert into session_tokens
- (
- uuid,
- user_uuid,
- expiration_date,
- created_at,
- updated_at
- )
- values (
- #{dto.uuid, jdbcType=VARCHAR},
- #{dto.userUuid, jdbcType=VARCHAR},
- #{dto.expirationDate, jdbcType=BIGINT},
- #{dto.createdAt, jdbcType=BIGINT},
- #{dto.updatedAt, jdbcType=BIGINT}
- )
- </insert>
-
- <update id="update" parameterType="Map">
- update session_tokens set
- expiration_date = #{dto.expirationDate, jdbcType=BIGINT},
- updated_at = #{dto.updatedAt, jdbcType=BIGINT}
- where
- uuid = #{dto.uuid, jdbcType=VARCHAR}
- </update>
-
- <delete id="deleteByUuid" parameterType="String">
- delete from session_tokens where uuid = #{uuid, jdbcType=VARCHAR}
- </delete>
-
- <delete id="deleteByUserUuid" parameterType="String">
- delete from session_tokens where user_uuid = #{userUuid, jdbcType=VARCHAR}
- </delete>
-
- <delete id="deleteExpired" parameterType="Long" >
- delete from session_tokens where expiration_date < #{now, jdbcType=BIGINT}
- </delete>
-
- </mapper>
|