新增加第三方登录授权功能
parent
204d882a8e
commit
e4b405491f
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>org.dromara</groupId>
|
||||
<artifactId>ruoyi-common</artifactId>
|
||||
<version>${revision}</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>ruoyi-common-auth</artifactId>
|
||||
<description>
|
||||
ruoyi-common-auth 认证模块
|
||||
</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>me.zhyd.oauth</groupId>
|
||||
<artifactId>JustAuth</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -0,0 +1,40 @@
|
||||
package org.dromara.system.domain;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@TableName("sys_auth_user")
|
||||
public class SysAuthUser {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 授权ID */
|
||||
private Long authId;
|
||||
|
||||
/** 第三方平台用户唯一ID */
|
||||
private String uuid;
|
||||
|
||||
/** 系统用户ID */
|
||||
private Long userId;
|
||||
|
||||
/** 登录账号 */
|
||||
private String userName;
|
||||
|
||||
/** 用户昵称 */
|
||||
private String nickName;
|
||||
|
||||
/** 头像地址 */
|
||||
private String avatar;
|
||||
|
||||
/** 用户邮箱 */
|
||||
private String email;
|
||||
|
||||
/** 用户来源 */
|
||||
private String source;
|
||||
|
||||
private String createTime;
|
||||
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
<?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="org.dromara.system.mapper.SysUserMapper">
|
||||
|
||||
<resultMap id="SysAuthUserResult" type="org.dromara.system.domain.SysAuthUser">
|
||||
<id property="authId" column="auth_id" />
|
||||
<result property="uuid" column="uuid" />
|
||||
<result property="userId" column="user_id" />
|
||||
<result property="userName" column="user_name" />
|
||||
<result property="nickName" column="nick_name" />
|
||||
<result property="avatar" column="avatar" />
|
||||
<result property="email" column="email" />
|
||||
<result property="source" column="source" />
|
||||
<result property="createTime" column="create_time" />
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectAuthUserByUuid" parameterType="String" resultMap="SysUserResult">
|
||||
select b.user_id as user_id, b.user_name as user_name, b.password as password , a.tenant_id as tenant_id
|
||||
from sys_auth_user a left join sys_user b on a.user_id = b.user_id
|
||||
where a.uuid = #{uuid} and b.del_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="selectAuthUserListByUserId" parameterType="Long" resultMap="SysAuthUserResult">
|
||||
select auth_id, uuid, user_id, user_name, nick_name, avatar, email, source, create_time, tenant_id from sys_auth_user where user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<select id="checkAuthUser" parameterType="org.dromara.system.domain.SysAuthUser" resultType="int">
|
||||
select count(1) from sys_auth_user where user_id=#{userId} and source=#{source} limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insertAuthUser" parameterType="org.dromara.system.domain.SysAuthUser">
|
||||
insert into sys_auth_user(
|
||||
<if test="uuid != null and uuid != ''">uuid,</if>
|
||||
<if test="userId != null and userId != 0">user_id,</if>
|
||||
<if test="userName != null and userName != ''">user_name,</if>
|
||||
<if test="nickName != null and nickName != ''">nick_name,</if>
|
||||
<if test="avatar != null and avatar != ''">avatar,</if>
|
||||
<if test="email != null and email != ''">email,</if>
|
||||
<if test="source != null and source != ''">source,</if>
|
||||
create_time
|
||||
)values(
|
||||
<if test="uuid != null and uuid != ''">#{uuid},</if>
|
||||
<if test="userId != null and userId != 0">#{userId},</if>
|
||||
<if test="userName != null and userName != ''">#{userName},</if>
|
||||
<if test="nickName != null and nickName != ''">#{nickName},</if>
|
||||
<if test="avatar != null and avatar != ''">#{avatar},</if>
|
||||
<if test="email != null and email != ''">#{email},</if>
|
||||
<if test="source != null and source != ''">#{source},</if>
|
||||
now()
|
||||
)
|
||||
</insert>
|
||||
|
||||
<delete id="deleteAuthUser" parameterType="Long">
|
||||
delete from sys_auth_user where auth_id = #{authId}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
@ -0,0 +1,14 @@
|
||||
CREATE TABLE `sys_auth_user` (
|
||||
`auth_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '授权ID',
|
||||
`uuid` varchar(500) NOT NULL COMMENT '第三方平台用户唯一ID',
|
||||
`user_id` bigint(20) unsigned NOT NULL COMMENT '系统用户ID',
|
||||
`user_name` varchar(30) NOT NULL COMMENT '登录账号',
|
||||
`nick_name` varchar(30) DEFAULT '' COMMENT '用户昵称',
|
||||
`avatar` varchar(500) DEFAULT '' COMMENT '头像地址',
|
||||
`email` varchar(255) DEFAULT '' COMMENT '用户邮箱',
|
||||
`source` varchar(255) DEFAULT '' COMMENT '用户来源',
|
||||
` tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户id',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`tenant_id` varchar(25) NOT NULL DEFAULT '000000',
|
||||
PRIMARY KEY (`auth_id`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=102 DEFAULT CHARSET=utf8mb4 COMMENT='第三方平台授权用户信息表';
|
Loading…
Reference in New Issue