2024-11-14 19:34:19 +08:00
|
|
|
<?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.electromagnetic.industry.software.data.manage.repository.dao.TokenMapper">
|
|
|
|
|
<resultMap id="TokenResultMap" type="com.electromagnetic.industry.software.data.manage.domain.boardservice.user.model.Token">
|
|
|
|
|
<id column="id" jdbcType="BIGINT" property="id" />
|
|
|
|
|
<result column="user_id" jdbcType="VARCHAR" property="userId" />
|
|
|
|
|
<result column="token" jdbcType="VARCHAR" property="token" />
|
|
|
|
|
<result column="is_long_term" jdbcType="TINYINT" property="isLongTerm" />
|
|
|
|
|
<result column="created_at" jdbcType="TIMESTAMP" property="createdAt" />
|
|
|
|
|
<result column="expire_at" jdbcType="TIMESTAMP" property="expireAt" />
|
|
|
|
|
</resultMap>
|
|
|
|
|
|
2024-11-15 17:25:24 +08:00
|
|
|
<sql id="selectTokenVo">
|
|
|
|
|
select id, user_id, token, is_long_term, created_at, expire_at from tokens
|
|
|
|
|
</sql>
|
|
|
|
|
|
2024-11-14 19:34:19 +08:00
|
|
|
<insert id="insert" parameterType="com.electromagnetic.industry.software.data.manage.domain.boardservice.user.model.Token">
|
|
|
|
|
insert into tokens(
|
|
|
|
|
<if test="userId != null and userId !='' ">user_id,</if>
|
|
|
|
|
<if test="token != null and token !='' ">token,</if>
|
|
|
|
|
is_long_term,
|
|
|
|
|
created_at,
|
|
|
|
|
<if test="expireAt != null">expire_at</if>
|
|
|
|
|
)
|
|
|
|
|
values (
|
|
|
|
|
<if test="userId != null and userId !='' ">#{userId},</if>
|
|
|
|
|
<if test="token != null and token !='' ">#{token},</if>
|
|
|
|
|
0,
|
|
|
|
|
now(),
|
|
|
|
|
<if test="expireAt !=null">#{expireAt}</if>
|
|
|
|
|
)
|
|
|
|
|
</insert>
|
2024-11-15 17:25:24 +08:00
|
|
|
|
|
|
|
|
<select id="selectToken" parameterType="String" resultMap="TokenResultMap">
|
|
|
|
|
<include refid="selectTokenVo" />
|
|
|
|
|
where token=#{token}
|
|
|
|
|
</select>
|
|
|
|
|
|
2024-11-26 11:06:17 +08:00
|
|
|
<delete id="deleteToken" parameterType="String">
|
|
|
|
|
delete from tokens where token=#{token}
|
|
|
|
|
</delete>
|
|
|
|
|
|
2024-11-14 19:34:19 +08:00
|
|
|
</mapper>
|