You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.8 KiB
51 lines
1.8 KiB
<?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.epmet.dao.ComponentAccessTokenDao">
|
|
|
|
<!-- 插入component_access_token信息 -->
|
|
<insert id="insertComponentAccessToken" parameterType="com.epmet.dto.form.ComponentAccessTokenFormDTO">
|
|
INSERT INTO component_access_token ( ID, COMPONENT_ACCESS_TOKEN, EXPIRES_IN_TIME, DEL_FLAG, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME )
|
|
VALUES
|
|
(
|
|
REPLACE ( UUID(), '-', '' ),
|
|
#{componentAccessToken},
|
|
#{expiresInTime},
|
|
#{delFlag},
|
|
#{createdBy},
|
|
NOW(),
|
|
#{updatedBy},
|
|
NOW()
|
|
)
|
|
</insert>
|
|
|
|
<!-- 删除旧的 component_access_token信息 -->
|
|
<delete id="deleteOldComponentAccessToken">
|
|
delete from component_access_token where del_flag = 0
|
|
</delete>
|
|
|
|
<select id="getComponentAccessToken" resultType="java.lang.String">
|
|
SELECT
|
|
COMPONENT_ACCESS_TOKEN
|
|
FROM
|
|
component_access_token
|
|
WHERE DEL_FLAG = '0'
|
|
</select>
|
|
|
|
<!-- 查询component_access_token 数量 -->
|
|
<select id="selectAccessTokenCount" resultType="java.lang.Integer">
|
|
select count(id) from component_access_token WHERE del_flag = 0
|
|
</select>
|
|
|
|
<!-- 查询即将过期【component_access_token】的数量 -->
|
|
<select id="selectWillOverTokenCount" resultType="java.lang.Integer">
|
|
SELECT
|
|
COUNT(*)
|
|
FROM
|
|
component_access_token
|
|
WHERE
|
|
del_flag = 0
|
|
AND (UNIX_TIMESTAMP(expires_in_time) - UNIX_TIMESTAMP(NOW())) <![CDATA[ <= ]]> 900
|
|
</select>
|
|
|
|
</mapper>
|