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.
120 lines
5.4 KiB
120 lines
5.4 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.ruoyi.quartz.mapper.DouYinMapper">
|
|
<insert id="addDouYinAuthorizedInfo">
|
|
INSERT INTO douyin_authorized_info (expires_in, open_id, refresh_expires_in,
|
|
refresh_token, scope, access_token, organ_code,
|
|
media_id, access_token_expires_date, refresh_token_expires_date,client_id)
|
|
VALUES (#{expiresIn}, #{openId}, #{refreshExpiresIn}, #{refreshToken}, #{scope}, #{accessToken}, #{organCode},
|
|
#{mediaId}, #{accessTokenExpiresDate}, #{refreshTokenExpiresDate},#{clientId})
|
|
</insert>
|
|
<insert id="addDouYinAuthorizedLog">
|
|
INSERT INTO douyin_authorization_callback_log(response_message, organ_code)
|
|
VALUES (#{responseMessage}, #{organCode})
|
|
</insert>
|
|
<insert id="adddouyinErrorLog">
|
|
INSERT INTO douyin_error_log (error_message,`describe`)
|
|
VALUES (#{errorMessage}, #{describe})
|
|
</insert>
|
|
<insert id="addDouYinVideoInFoList">
|
|
INSERT INTO douyin_video_info (item_id, media_type, title, cover, is_top,
|
|
create_time, is_reviewed, video_status, share_url, statistics, organ_code, open_id)
|
|
VALUES
|
|
<foreach collection="list" item="item" separator=",">
|
|
(#{item.itemId}, #{item.mediaType}, #{item.title}, #{item.cover} , #{item.isTop} ,
|
|
#{item.createTime} ,
|
|
#{item.isReviewed} , #{item.videoStatus} , #{item.shareUrl} , #{item.statistics} ,
|
|
#{organCode}, #{openId})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<insert id="addDouYinVideoInFo">
|
|
INSERT INTO douyin_video_info (item_id, media_type, title, cover, is_top,
|
|
create_time, is_reviewed, video_status, share_url, statistics, organ_code, open_id)
|
|
VALUES
|
|
|
|
(#{data.itemId}, #{data.mediaType}, #{data.title}, #{data.cover} , #{data.isTop} ,
|
|
#{data.createTime} ,
|
|
#{data.isReviewed} , #{data.videoStatus} , #{data.shareUrl} , #{data.statistics} ,
|
|
#{organCode}, #{openId})
|
|
|
|
</insert>
|
|
|
|
<update id="updateWeiBoAuthorizedToekn">
|
|
update douyin_authorized_info
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="expiresIn != null and expiresIn != ''">expires_in = #{expiresIn},</if>
|
|
<if test="refreshExpiresIn != null and refreshExpiresIn != ''">refresh_expires_in = #{refreshExpiresIn},</if>
|
|
<if test="refreshToken != null and refreshToken != ''">refresh_token = #{refreshToken},</if>
|
|
<if test="scope != null and scope != ''"> scope = #{scope},</if>
|
|
<if test="accessToken != null and accessToken != ''">access_token = #{accessToken},</if>
|
|
<if test="accessTokenExpiresDate != null and accessTokenExpiresDate != ''">access_token_expires_date = #{accessTokenExpiresDate},</if>
|
|
<if test="refreshTokenExpiresDate != null and refreshTokenExpiresDate != ''">refresh_token_expires_date = #{refreshTokenExpiresDate},</if>
|
|
|
|
</trim>
|
|
WHERE open_id = #{openId}
|
|
</update>
|
|
|
|
|
|
<select id="getDouYinConfigByClientId" resultType="com.cjy.douyin.domain.DouyingConfig">
|
|
|
|
select id,
|
|
client_id as clientId,
|
|
client_secret as clientSecret,
|
|
redirect_uri as redirectUri,
|
|
organ_code as organCode,
|
|
media_id as mediaId,
|
|
state,
|
|
create_time as createTime,
|
|
del_flag
|
|
from douying_config
|
|
where client_id = #{clientId}
|
|
and state = '0'
|
|
</select>
|
|
<select id="getWeiBoAuthorized" resultType="java.lang.Integer">
|
|
select count(*)
|
|
from douyin_authorized_info
|
|
where open_id = #{openId}
|
|
</select>
|
|
<select id="getDouYinAuthorizedInfo" resultType="com.ruoyi.quartz.domain.dto.DouYinAuthorizedInfoDTO">
|
|
SELECT
|
|
id,
|
|
expires_in AS expiresIn,
|
|
open_id AS openId,
|
|
refresh_expires_in AS refreshExpiresIn,
|
|
refresh_token AS refreshToken,
|
|
scope,
|
|
access_token AS accessToken,
|
|
organ_code AS organCode,
|
|
media_id as mediaId,
|
|
access_token_expires_date as accessTokenExpiresDate,
|
|
refresh_token_expires_date as refreshTokenExpiresDate,
|
|
client_id as clientId
|
|
FROM
|
|
douyin_authorized_info
|
|
WHERE (DATE_FORMAT(access_token_expires_date, '%Y-%m-%d')=CURDATE() or DATE_FORMAT(refresh_token_expires_date, '%Y-%m-%d')=CURDATE())
|
|
</select>
|
|
|
|
|
|
<select id="getAllDouYinAuthorizedInfo" resultType="com.ruoyi.quartz.domain.dto.DouYinAuthorizedInfoDTO">
|
|
SELECT
|
|
t1.id,
|
|
t1.expires_in AS expiresIn,
|
|
t1.open_id AS openId,
|
|
t1.refresh_expires_in AS refreshExpiresIn,
|
|
t1.refresh_token AS refreshToken,
|
|
t1.scope,
|
|
t1.access_token AS accessToken,
|
|
t1.organ_code AS organCode,
|
|
t1.media_id as mediaId,
|
|
t1.access_token_expires_date as accessTokenExpiresDate,
|
|
t1.refresh_token_expires_date as refreshTokenExpiresDate,
|
|
t1.client_id as clientId
|
|
FROM
|
|
douyin_authorized_info t1
|
|
left join douying_config t2 on t1.client_id=t2.client_id
|
|
where t2.state=0
|
|
</select>
|
|
</mapper>
|
|
|