[功能]:1、添加http通用接口forest 2、引入justoauth 处理第三方登录 3、大致完成qq登录代码 4、前端界面修改适配第三方登录逻辑

This commit is contained in:
LemonTree
2022-04-20 18:31:04 +08:00
parent bb2cdebac3
commit 9bdcf7a60d
25 changed files with 2681 additions and 0 deletions

View File

@@ -0,0 +1,141 @@
<?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.iot.mapper.SocialPlatformMapper">
<resultMap type="SocialPlatform" id="SocialPlatformResult">
<result property="socialPlatformId" column="social_platform_id"/>
<result property="platform" column="platform"/>
<result property="status" column="status"/>
<result property="clientId" column="client_id"/>
<result property="secretKey" column="secret_key"/>
<result property="redirectUri" column="redirect_uri"/>
<result property="delFlag" column="del_flag"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by"/>
<result property="remark" column="remark"/>
<result property="bindUri" column="bind_uri"/>
<result property="redirectLoginUri" column="redirect_login_uri"/>
<result property="errorMsgUri" column="error_msg_uri"/>
</resultMap>
<sql id="selectSocialPlatformVo">
select social_platform_id,
platform,
status,
client_id,
secret_key,
redirect_uri,
del_flag,
create_by,
create_time,
update_time,
update_by,
remark,
bind_uri,
redirect_login_uri,
error_msg_uri
from iot_social_platform
</sql>
<select id="selectSocialPlatformList" parameterType="SocialPlatform" resultMap="SocialPlatformResult">
<include refid="selectSocialPlatformVo"/>
<where>
<if test="platform != null and platform != ''">and platform = #{platform}</if>
<if test="status != null and status != ''">and status = #{status}</if>
<if test="clientId != null and clientId != ''">and client_id = #{clientId}</if>
<if test="secretKey != null and secretKey != ''">and secret_key = #{secretKey}</if>
<if test="redirectUri != null and redirectUri != ''">and redirect_uri = #{redirectUri}</if>
<if test="bindUri != null and bindUri != ''">and bind_uri = #{bindUri}</if>
<if test="redirectLoginUri != null and redirectLoginUri != ''">and redirect_login_uri =
#{redirectLoginUri}
</if>
<if test="errorMsgUri != null ">and error_msg_uri = #{errorMsgUri}</if>
</where>
</select>
<select id="selectSocialPlatformBySocialPlatformId" parameterType="Long" resultMap="SocialPlatformResult">
<include refid="selectSocialPlatformVo"/>
where social_platform_id = #{socialPlatformId}
</select>
<select id="selectSocialPlatformByPlatform" parameterType="String" resultMap="SocialPlatformResult">
<include refid="selectSocialPlatformVo"/>
where platform = #{platform}
</select>
<insert id="insertSocialPlatform" parameterType="SocialPlatform" useGeneratedKeys="true"
keyProperty="socialPlatformId">
insert into iot_social_platform
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="platform != null and platform != ''">platform,</if>
<if test="status != null and status != ''">status,</if>
<if test="clientId != null and clientId != ''">client_id,</if>
<if test="secretKey != null and secretKey != ''">secret_key,</if>
<if test="redirectUri != null and redirectUri != ''">redirect_uri,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="remark != null">remark,</if>
<if test="bindUri != null and bindUri != ''">bind_uri,</if>
<if test="redirectLoginUri != null and redirectLoginUri != ''">redirect_login_uri,</if>
<if test="errorMsgUri != null and errorMsgUri != ''">error_msg_uri,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="platform != null and platform != ''">#{platform},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="clientId != null and clientId != ''">#{clientId},</if>
<if test="secretKey != null and secretKey != ''">#{secretKey},</if>
<if test="redirectUri != null and redirectUri != ''">#{redirectUri},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="remark != null">#{remark},</if>
<if test="bindUri != null and bindUri != ''">#{bindUri},</if>
<if test="redirectLoginUri != null and redirectLoginUri != ''">#{redirectLoginUri},</if>
<if test="errorMsgUri != null and errorMsgUri != ''">#{errorMsgUri},</if>
</trim>
</insert>
<update id="updateSocialPlatform" parameterType="SocialPlatform">
update iot_social_platform
<trim prefix="SET" suffixOverrides=",">
<if test="platform != null and platform != ''">platform = #{platform},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="clientId != null and clientId != ''">client_id = #{clientId},</if>
<if test="secretKey != null and secretKey != ''">secret_key = #{secretKey},</if>
<if test="redirectUri != null and redirectUri != ''">redirect_uri = #{redirectUri},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="bindUri != null and bindUri != ''">bind_uri = #{bindUri},</if>
<if test="redirectLoginUri != null and redirectLoginUri != ''">redirect_login_uri = #{redirectLoginUri},
</if>
<if test="errorMsgUri != null and errorMsgUri != ''">error_msg_uri = #{errorMsgUri},</if>
</trim>
where social_platform_id = #{socialPlatformId}
</update>
<delete id="deleteSocialPlatformBySocialPlatformId" parameterType="Long">
delete
from iot_social_platform
where social_platform_id = #{socialPlatformId}
</delete>
<delete id="deleteSocialPlatformBySocialPlatformIds" parameterType="String">
delete from iot_social_platform where social_platform_id in
<foreach item="socialPlatformId" collection="array" open="(" separator="," close=")">
#{socialPlatformId}
</foreach>
</delete>
</mapper>

View File

@@ -0,0 +1,219 @@
<?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.iot.mapper.SocialUserMapper">
<resultMap type="SocialUser" id="SocialUserResult">
<result property="socialUserId" column="social_user_id"/>
<result property="uuid" column="uuid"/>
<result property="source" column="source"/>
<result property="accessToken" column="access_token"/>
<result property="expireIn" column="expire_in"/>
<result property="refreshToken" column="refresh_token"/>
<result property="openId" column="open_id"/>
<result property="uid" column="uid"/>
<result property="accessCode" column="access_code"/>
<result property="unionId" column="union_id"/>
<result property="scope" column="scope"/>
<result property="tokenType" column="token_type"/>
<result property="idToken" column="id_token"/>
<result property="macAlgorithm" column="mac_algorithm"/>
<result property="macKey" column="mac_key"/>
<result property="code" column="code"/>
<result property="oauthToken" column="oauth_token"/>
<result property="oauthTokenSecret" column="oauth_token_secret"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by"/>
<result property="delFlag" column="del_flag"/>
<result property="status" column="status"/>
<result property="sysUserId" column="sys_user_id"/>
<result property="username" column="username"/>
<result property="nickname" column="nickname"/>
<result property="avatar" column="avatar"/>
<result property="gender" column="gender"/>
</resultMap>
<sql id="selectSocialUserVo">
select social_user_id,
uuid,
source,
access_token,
expire_in,
refresh_token,
open_id,
uid,
access_code,
union_id,
scope,
token_type,
id_token,
mac_algorithm,
mac_key,
code,
oauth_token,
oauth_token_secret,
create_time,
create_by,
update_time,
update_by,
del_flag,
status,
sys_user_id,
username,
nickname,
avatar,
gender
from iot_social_user
</sql>
<select id="selectSocialUserList" parameterType="SocialUser" resultMap="SocialUserResult">
<include refid="selectSocialUserVo"/>
<where>
<if test="uuid != null and uuid != ''">and uuid = #{uuid}</if>
<if test="source != null and source != ''">and source = #{source}</if>
<if test="accessToken != null and accessToken != ''">and access_token = #{accessToken}</if>
<if test="expireIn != null ">and expire_in = #{expireIn}</if>
<if test="refreshToken != null and refreshToken != ''">and refresh_token = #{refreshToken}</if>
<if test="openId != null and openId != ''">and open_id = #{openId}</if>
<if test="uid != null and uid != ''">and uid = #{uid}</if>
<if test="accessCode != null and accessCode != ''">and access_code = #{accessCode}</if>
<if test="unionId != null and unionId != ''">and union_id = #{unionId}</if>
<if test="scope != null and scope != ''">and scope = #{scope}</if>
<if test="tokenType != null and tokenType != ''">and token_type = #{tokenType}</if>
<if test="idToken != null and idToken != ''">and id_token = #{idToken}</if>
<if test="macAlgorithm != null and macAlgorithm != ''">and mac_algorithm = #{macAlgorithm}</if>
<if test="macKey != null and macKey != ''">and mac_key = #{macKey}</if>
<if test="code != null and code != ''">and code = #{code}</if>
<if test="oauthToken != null and oauthToken != ''">and oauth_token = #{oauthToken}</if>
<if test="oauthTokenSecret != null and oauthTokenSecret != ''">and oauth_token_secret =
#{oauthTokenSecret}
</if>
<if test="status != null and status != ''">and status = #{status}</if>
<if test="sysUserId != null ">and sys_user_id = #{sysUserId}</if>
<if test="username != null and username != ''">and username like concat('%', #{username}, '%')</if>
<if test="nickname != null and nickname != ''">and nickname like concat('%', #{nickname}, '%')</if>
<if test="avatar != null and avatar != ''">and avatar = #{avatar}</if>
<if test="gender != null ">and gender = #{gender}</if>
</where>
</select>
<select id="selectSocialUserBySocialUserId" parameterType="Long" resultMap="SocialUserResult">
<include refid="selectSocialUserVo"/>
where social_user_id = #{socialUserId}
</select>
<insert id="insertSocialUser" parameterType="SocialUser" useGeneratedKeys="true" keyProperty="socialUserId">
insert into iot_social_user
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="uuid != null and uuid != ''">uuid,</if>
<if test="source != null and source != ''">source,</if>
<if test="accessToken != null and accessToken != ''">access_token,</if>
<if test="expireIn != null">expire_in,</if>
<if test="refreshToken != null">refresh_token,</if>
<if test="openId != null">open_id,</if>
<if test="uid != null">uid,</if>
<if test="accessCode != null">access_code,</if>
<if test="unionId != null">union_id,</if>
<if test="scope != null">scope,</if>
<if test="tokenType != null">token_type,</if>
<if test="idToken != null">id_token,</if>
<if test="macAlgorithm != null">mac_algorithm,</if>
<if test="macKey != null">mac_key,</if>
<if test="code != null">code,</if>
<if test="oauthToken != null">oauth_token,</if>
<if test="oauthTokenSecret != null">oauth_token_secret,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
<if test="status != null and status != ''">status,</if>
<if test="sysUserId != null">sys_user_id,</if>
<if test="username != null">username,</if>
<if test="nickname != null">nickname,</if>
<if test="avatar != null">avatar,</if>
<if test="gender != null">gender,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="uuid != null and uuid != ''">#{uuid},</if>
<if test="source != null and source != ''">#{source},</if>
<if test="accessToken != null and accessToken != ''">#{accessToken},</if>
<if test="expireIn != null">#{expireIn},</if>
<if test="refreshToken != null">#{refreshToken},</if>
<if test="openId != null">#{openId},</if>
<if test="uid != null">#{uid},</if>
<if test="accessCode != null">#{accessCode},</if>
<if test="unionId != null">#{unionId},</if>
<if test="scope != null">#{scope},</if>
<if test="tokenType != null">#{tokenType},</if>
<if test="idToken != null">#{idToken},</if>
<if test="macAlgorithm != null">#{macAlgorithm},</if>
<if test="macKey != null">#{macKey},</if>
<if test="code != null">#{code},</if>
<if test="oauthToken != null">#{oauthToken},</if>
<if test="oauthTokenSecret != null">#{oauthTokenSecret},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
<if test="status != null and status != ''">#{status},</if>
<if test="sysUserId != null">#{sysUserId},</if>
<if test="username != null">#{username},</if>
<if test="nickname != null">#{nickname},</if>
<if test="avatar != null">#{avatar},</if>
<if test="gender != null">#{gender},</if>
</trim>
</insert>
<update id="updateSocialUser" parameterType="SocialUser">
update iot_social_user
<trim prefix="SET" suffixOverrides=",">
<if test="uuid != null and uuid != ''">uuid = #{uuid},</if>
<if test="source != null and source != ''">source = #{source},</if>
<if test="accessToken != null and accessToken != ''">access_token = #{accessToken},</if>
<if test="expireIn != null">expire_in = #{expireIn},</if>
<if test="refreshToken != null">refresh_token = #{refreshToken},</if>
<if test="openId != null">open_id = #{openId},</if>
<if test="uid != null">uid = #{uid},</if>
<if test="accessCode != null">access_code = #{accessCode},</if>
<if test="unionId != null">union_id = #{unionId},</if>
<if test="scope != null">scope = #{scope},</if>
<if test="tokenType != null">token_type = #{tokenType},</if>
<if test="idToken != null">id_token = #{idToken},</if>
<if test="macAlgorithm != null">mac_algorithm = #{macAlgorithm},</if>
<if test="macKey != null">mac_key = #{macKey},</if>
<if test="code != null">code = #{code},</if>
<if test="oauthToken != null">oauth_token = #{oauthToken},</if>
<if test="oauthTokenSecret != null">oauth_token_secret = #{oauthTokenSecret},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
<if test="status != null and status != ''">status = #{status},</if>
<if test="sysUserId != null">sys_user_id = #{sysUserId},</if>
<if test="username != null">username = #{username},</if>
<if test="nickname != null">nickname = #{nickname},</if>
<if test="avatar != null">avatar = #{avatar},</if>
<if test="gender != null">gender = #{gender},</if>
</trim>
where social_user_id = #{socialUserId}
</update>
<delete id="deleteSocialUserBySocialUserId" parameterType="Long">
delete
from iot_social_user
where social_user_id = #{socialUserId}
</delete>
<delete id="deleteSocialUserBySocialUserIds" parameterType="String">
delete from iot_social_user where social_user_id in
<foreach item="socialUserId" collection="array" open="(" separator="," close=")">
#{socialUserId}
</foreach>
</delete>
</mapper>