update 优化 !pr370 完成三方登录授权功能
This commit is contained in:
parent
50fbfe2cb4
commit
9448782f45
@ -25,7 +25,7 @@ import org.dromara.common.social.utils.SocialUtils;
|
|||||||
import org.dromara.common.tenant.helper.TenantHelper;
|
import org.dromara.common.tenant.helper.TenantHelper;
|
||||||
import org.dromara.system.domain.bo.SysTenantBo;
|
import org.dromara.system.domain.bo.SysTenantBo;
|
||||||
import org.dromara.system.domain.vo.SysTenantVo;
|
import org.dromara.system.domain.vo.SysTenantVo;
|
||||||
import org.dromara.system.service.ISocialUserService;
|
import org.dromara.system.service.ISysSocialService;
|
||||||
import org.dromara.system.service.ISysConfigService;
|
import org.dromara.system.service.ISysConfigService;
|
||||||
import org.dromara.system.service.ISysTenantService;
|
import org.dromara.system.service.ISysTenantService;
|
||||||
import org.dromara.web.domain.vo.LoginTenantVo;
|
import org.dromara.web.domain.vo.LoginTenantVo;
|
||||||
@ -36,7 +36,6 @@ import org.dromara.web.service.SysRegisterService;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ -57,8 +56,7 @@ public class AuthController {
|
|||||||
private final SysRegisterService registerService;
|
private final SysRegisterService registerService;
|
||||||
private final ISysConfigService configService;
|
private final ISysConfigService configService;
|
||||||
private final ISysTenantService tenantService;
|
private final ISysTenantService tenantService;
|
||||||
private final ISocialUserService socialUserService;
|
private final ISysSocialService socialUserService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -133,11 +131,12 @@ public class AuthController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 认证授权
|
* 认证授权
|
||||||
* @param source
|
*
|
||||||
|
* @param source 登录来源
|
||||||
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@GetMapping("/binding/{source}")
|
@GetMapping("/binding/{source}")
|
||||||
@ResponseBody
|
public R<String> authBinding(@PathVariable("source") String source) {
|
||||||
public R<LoginVo> authBinding(@PathVariable("source") String source, HttpServletRequest request){
|
|
||||||
SocialLoginConfigProperties obj = socialProperties.getType().get(source);
|
SocialLoginConfigProperties obj = socialProperties.getType().get(source);
|
||||||
if (ObjectUtil.isNull(obj)) {
|
if (ObjectUtil.isNull(obj)) {
|
||||||
return R.fail(source + "平台账号暂不支持");
|
return R.fail(source + "平台账号暂不支持");
|
||||||
@ -152,14 +151,14 @@ public class AuthController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 第三方登录回调业务处理
|
* 第三方登录回调业务处理
|
||||||
* @param source
|
*
|
||||||
* @param callback
|
* @param source 登录来源
|
||||||
* @param request
|
* @param callback 授权响应实体
|
||||||
* @return
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@GetMapping("/social-login/{source}")
|
@GetMapping("/social-login/{source}")
|
||||||
public R<String> socialLogin(@PathVariable("source") String source, AuthCallback callback, HttpServletRequest request) throws IOException {
|
public R<String> socialLogin(@PathVariable("source") String source, AuthCallback callback) {
|
||||||
SocialLoginConfigProperties obj = socialProperties.getType().get(source);
|
SocialLoginConfigProperties obj = socialProperties.getType().get(source);
|
||||||
if (ObjectUtil.isNull(obj)) {
|
if (ObjectUtil.isNull(obj)) {
|
||||||
return R.fail(source + "平台账号暂不支持");
|
return R.fail(source + "平台账号暂不支持");
|
||||||
@ -169,16 +168,16 @@ public class AuthController {
|
|||||||
obj.getClientSecret(),
|
obj.getClientSecret(),
|
||||||
obj.getRedirectUri());
|
obj.getRedirectUri());
|
||||||
AuthResponse<AuthUser> response = authRequest.login(callback);
|
AuthResponse<AuthUser> response = authRequest.login(callback);
|
||||||
return loginService.socialLogin(source, response, request);
|
return loginService.socialLogin(source, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取消授权
|
* 取消授权
|
||||||
* @param socialId
|
*
|
||||||
|
* @param socialId socialId
|
||||||
*/
|
*/
|
||||||
@DeleteMapping(value = "/unlock/{socialId}")
|
@DeleteMapping(value = "/unlock/{socialId}")
|
||||||
public R<Void> unlockSocial(@PathVariable Long socialId)
|
public R<Void> unlockSocial(@PathVariable Long socialId) {
|
||||||
{
|
|
||||||
Boolean rows = socialUserService.deleteWithValidById(socialId);
|
Boolean rows = socialUserService.deleteWithValidById(socialId);
|
||||||
return rows ? R.ok() : R.fail("取消授权失败");
|
return rows ? R.ok() : R.fail("取消授权失败");
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ import cn.dev33.satoken.stp.StpUtil;
|
|||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import me.zhyd.oauth.model.AuthResponse;
|
import me.zhyd.oauth.model.AuthResponse;
|
||||||
@ -33,20 +32,18 @@ import org.dromara.common.tenant.exception.TenantException;
|
|||||||
import org.dromara.common.tenant.helper.TenantHelper;
|
import org.dromara.common.tenant.helper.TenantHelper;
|
||||||
import org.dromara.common.web.config.properties.CaptchaProperties;
|
import org.dromara.common.web.config.properties.CaptchaProperties;
|
||||||
import org.dromara.system.domain.SysUser;
|
import org.dromara.system.domain.SysUser;
|
||||||
import org.dromara.system.domain.bo.SocialUserBo;
|
import org.dromara.system.domain.bo.SysSocialBo;
|
||||||
import org.dromara.system.domain.vo.SocialUserVo;
|
import org.dromara.system.domain.vo.SysSocialVo;
|
||||||
import org.dromara.system.domain.vo.SysTenantVo;
|
import org.dromara.system.domain.vo.SysTenantVo;
|
||||||
import org.dromara.system.domain.vo.SysUserVo;
|
import org.dromara.system.domain.vo.SysUserVo;
|
||||||
import org.dromara.system.mapper.SysUserMapper;
|
import org.dromara.system.mapper.SysUserMapper;
|
||||||
import org.dromara.system.service.ISocialUserService;
|
import org.dromara.system.service.ISysSocialService;
|
||||||
import org.dromara.system.service.ISysPermissionService;
|
import org.dromara.system.service.ISysPermissionService;
|
||||||
import org.dromara.system.service.ISysTenantService;
|
import org.dromara.system.service.ISysTenantService;
|
||||||
import org.dromara.system.service.ISysUserService;
|
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -63,7 +60,7 @@ import java.util.function.Supplier;
|
|||||||
public class SysLoginService {
|
public class SysLoginService {
|
||||||
|
|
||||||
private final SysUserMapper userMapper;
|
private final SysUserMapper userMapper;
|
||||||
private final ISocialUserService socialUserService;
|
private final ISysSocialService sysSocialService;
|
||||||
private final CaptchaProperties captchaProperties;
|
private final CaptchaProperties captchaProperties;
|
||||||
private final ISysPermissionService permissionService;
|
private final ISysPermissionService permissionService;
|
||||||
private final ISysTenantService tenantService;
|
private final ISysTenantService tenantService;
|
||||||
@ -170,16 +167,15 @@ public class SysLoginService {
|
|||||||
*
|
*
|
||||||
* @param source 登录来源
|
* @param source 登录来源
|
||||||
* @param authUser 授权响应实体
|
* @param authUser 授权响应实体
|
||||||
* @param request Http请求对象
|
|
||||||
* @return 统一响应实体
|
* @return 统一响应实体
|
||||||
*/
|
*/
|
||||||
public R<String> socialLogin(String source, AuthResponse<AuthUser> authUser, HttpServletRequest request) {
|
public R<String> socialLogin(String source, AuthResponse<AuthUser> authUser) {
|
||||||
// 判断授权响应是否成功
|
// 判断授权响应是否成功
|
||||||
if (!authUser.ok()) {
|
if (!authUser.ok()) {
|
||||||
return R.fail("对不起,授权信息验证不通过,请退出重试!");
|
return R.fail("对不起,授权信息验证不通过,请退出重试!");
|
||||||
}
|
}
|
||||||
AuthUser authUserData = authUser.getData();
|
AuthUser authUserData = authUser.getData();
|
||||||
SocialUserVo user = socialUserService.selectSocialUserByAuthId(authUserData.getSource() + authUserData.getUuid());
|
SysSocialVo user = sysSocialService.selectByAuthId(authUserData.getSource() + authUserData.getUuid());
|
||||||
if (ObjectUtil.isNotNull(user)) {
|
if (ObjectUtil.isNotNull(user)) {
|
||||||
// 执行登录和记录登录信息操作
|
// 执行登录和记录登录信息操作
|
||||||
return loginAndRecord(user.getTenantId(), user.getUserName(), authUserData);
|
return loginAndRecord(user.getTenantId(), user.getUserName(), authUserData);
|
||||||
@ -188,20 +184,20 @@ public class SysLoginService {
|
|||||||
if (LoginHelper.getUserId() == null) {
|
if (LoginHelper.getUserId() == null) {
|
||||||
return R.fail("授权失败,请先登录才能绑定");
|
return R.fail("授权失败,请先登录才能绑定");
|
||||||
}
|
}
|
||||||
SocialUserBo socialUserBo = new SocialUserBo();
|
SysSocialBo bo = new SysSocialBo();
|
||||||
socialUserBo.setUserId(LoginHelper.getUserId());
|
bo.setUserId(LoginHelper.getUserId());
|
||||||
socialUserBo.setAuthId(authUserData.getSource() + authUserData.getUuid());
|
bo.setAuthId(authUserData.getSource() + authUserData.getUuid());
|
||||||
socialUserBo.setSource(authUserData.getSource());
|
bo.setSource(authUserData.getSource());
|
||||||
socialUserBo.setUserName(authUserData.getUsername());
|
bo.setUserName(authUserData.getUsername());
|
||||||
socialUserBo.setNickName(authUserData.getNickname());
|
bo.setNickName(authUserData.getNickname());
|
||||||
socialUserBo.setAvatar(authUserData.getAvatar());
|
bo.setAvatar(authUserData.getAvatar());
|
||||||
socialUserBo.setOpenId(authUserData.getUuid());
|
bo.setOpenId(authUserData.getUuid());
|
||||||
BeanUtils.copyProperties(authUserData.getToken(), socialUserBo);
|
BeanUtils.copyProperties(authUserData.getToken(), bo);
|
||||||
|
|
||||||
socialUserService.insertByBo(socialUserBo);
|
sysSocialService.insertByBo(bo);
|
||||||
SysUserVo lodingData = loadUserByUsername(LoginHelper.getTenantId(), LoginHelper.getUsername());
|
SysUserVo sysUser = loadUserByUsername(LoginHelper.getTenantId(), LoginHelper.getUsername());
|
||||||
// 执行登录和记录登录信息操作
|
// 执行登录和记录登录信息操作
|
||||||
return loginAndRecord(lodingData.getTenantId(), socialUserBo.getUserName(), authUserData);
|
return loginAndRecord(sysUser.getTenantId(), sysUser.getUserName(), authUserData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,150 +179,63 @@ sms:
|
|||||||
territory: ap-guangzhou
|
territory: ap-guangzhou
|
||||||
|
|
||||||
|
|
||||||
|
--- # 三方授权
|
||||||
justauth:
|
justauth:
|
||||||
enabled: true
|
enabled: true
|
||||||
type:
|
type:
|
||||||
QQ:
|
qq:
|
||||||
client-id: 10**********6
|
client-id: 10**********6
|
||||||
client-secret: 1f7d08**********5b7**********29e
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
redirect-uri: http://oauth.xkcoding.com/demo/oauth/qq/callback
|
redirect-uri: http://localhost:80/social-login?source=qq
|
||||||
union-id: false
|
union-id: false
|
||||||
WEIBO:
|
weibo:
|
||||||
client-id: 10**********6
|
client-id: 10**********6
|
||||||
client-secret: 1f7d08**********5b7**********29e
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
redirect-uri: http://oauth.xkcoding.com/demo/oauth/weibo/callback
|
redirect-uri: http://localhost:80/social-login?source=weibo
|
||||||
gitee:
|
gitee:
|
||||||
client-id: 38eaaa1b77b5e064313057a2f5745ce3a9f3e7686d9bd302c7df2f308ef6db81
|
client-id: 914******************98
|
||||||
client-secret: 2e633af8780cb9fe002c4c7291b722db944402e271efb99b062811f52d7da1ff
|
client-secret: 02*****************ac
|
||||||
redirect-uri: http://localhost:80/social-login?source=gitee
|
redirect-uri: http://localhost:80/social-login?source=gitee
|
||||||
DINGTALK:
|
dingtalk:
|
||||||
client-id: 10**********6
|
client-id: 10**********6
|
||||||
client-secret: 1f7d08**********5b7**********29e
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
redirect-uri: http://oauth.xkcoding.com/demo/oauth/dingtalk/callback
|
redirect-uri: http://localhost:80/social-login?source=dingtalk
|
||||||
BAIDU:
|
baidu:
|
||||||
client-id: 10**********6
|
client-id: 10**********6
|
||||||
client-secret: 1f7d08**********5b7**********29e
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
redirect-uri: http://oauth.xkcoding.com/demo/oauth/baidu/callback
|
redirect-uri: http://localhost:80/social-login?source=baidu
|
||||||
CSDN:
|
csdn:
|
||||||
client-id: 10**********6
|
client-id: 10**********6
|
||||||
client-secret: 1f7d08**********5b7**********29e
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
redirect-uri: http://oauth.xkcoding.com/demo/oauth/csdn/callback
|
redirect-uri: http://localhost:80/social-login?source=csdn
|
||||||
CODING:
|
coding:
|
||||||
client-id: 10**********6
|
client-id: 10**********6
|
||||||
client-secret: 1f7d08**********5b7**********29e
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
redirect-uri: http://oauth.xkcoding.com/demo/oauth/coding/callback
|
redirect-uri: http://localhost:80/social-login?source=coding
|
||||||
coding-group-name: xx
|
coding-group-name: xx
|
||||||
OSCHINA:
|
oschina:
|
||||||
client-id: 10**********6
|
client-id: 10**********6
|
||||||
client-secret: 1f7d08**********5b7**********29e
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
redirect-uri: http://oauth.xkcoding.com/demo/oauth/oschina/callback
|
redirect-uri: http://localhost:80/social-login?source=oschina
|
||||||
ALIPAY:
|
alipay:
|
||||||
client-id: 10**********6
|
client-id: 10**********6
|
||||||
client-secret: 1f7d08**********5b7**********29e
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
redirect-uri: http://oauth.xkcoding.com/demo/oauth/alipay/callback
|
redirect-uri: http://localhost:80/social-login?source=alipay
|
||||||
alipay-public-key: MIIB**************DAQAB
|
alipay-public-key: MIIB**************DAQAB
|
||||||
WECHAT_OPEN:
|
wechat_open:
|
||||||
client-id: 10**********6
|
client-id: 10**********6
|
||||||
client-secret: 1f7d08**********5b7**********29e
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
redirect-uri: http://oauth.xkcoding.com/demo/oauth/wechat_open/callback
|
redirect-uri: http://localhost:80/social-login?source=wechat_open
|
||||||
WECHAT_MP:
|
wechat_mp:
|
||||||
client-id: 10**********6
|
client-id: 10**********6
|
||||||
client-secret: 1f7d08**********5b7**********29e
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
redirect-uri: http://oauth.xkcoding.com/demo/oauth/wechat_mp/callback
|
redirect-uri: http://localhost:80/social-login?source=wechat_mp
|
||||||
WECHAT_ENTERPRISE:
|
wechat_enterprise:
|
||||||
client-id: 10**********6
|
client-id: 10**********6
|
||||||
client-secret: 1f7d08**********5b7**********29e
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
redirect-uri: http://oauth.xkcoding.com/demo/oauth/wechat_enterprise/callback
|
redirect-uri: http://localhost:80/social-login?source=wechat_enterprise
|
||||||
agent-id: 1000002
|
agent-id: 1000002
|
||||||
TAOBAO:
|
gitlab:
|
||||||
client-id: 10**********6
|
client-id: 10**********6
|
||||||
client-secret: 1f7d08**********5b7**********29e
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
redirect-uri: http://oauth.xkcoding.com/demo/oauth/taobao/callback
|
redirect-uri: http://localhost:80/social-login?source=gitlab
|
||||||
GOOGLE:
|
|
||||||
client-id: 10**********6
|
|
||||||
client-secret: 1f7d08**********5b7**********29e
|
|
||||||
redirect-uri: http://oauth.xkcoding.com/demo/oauth/google/callback
|
|
||||||
FACEBOOK:
|
|
||||||
client-id: 10**********6
|
|
||||||
client-secret: 1f7d08**********5b7**********29e
|
|
||||||
redirect-uri: http://oauth.xkcoding.com/demo/oauth/facebook/callback
|
|
||||||
DOUYIN:
|
|
||||||
client-id: 10**********6
|
|
||||||
client-secret: 1f7d08**********5b7**********29e
|
|
||||||
redirect-uri: http://oauth.xkcoding.com/demo/oauth/douyin/callback
|
|
||||||
LINKEDIN:
|
|
||||||
client-id: 10**********6
|
|
||||||
client-secret: 1f7d08**********5b7**********29e
|
|
||||||
redirect-uri: http://oauth.xkcoding.com/demo/oauth/linkedin/callback
|
|
||||||
MICROSOFT:
|
|
||||||
client-id: 10**********6
|
|
||||||
client-secret: 1f7d08**********5b7**********29e
|
|
||||||
redirect-uri: http://oauth.xkcoding.com/demo/oauth/microsoft/callback
|
|
||||||
MI:
|
|
||||||
client-id: 10**********6
|
|
||||||
client-secret: 1f7d08**********5b7**********29e
|
|
||||||
redirect-uri: http://oauth.xkcoding.com/demo/oauth/mi/callback
|
|
||||||
TOUTIAO:
|
|
||||||
client-id: 10**********6
|
|
||||||
client-secret: 1f7d08**********5b7**********29e
|
|
||||||
redirect-uri: http://oauth.xkcoding.com/demo/oauth/toutiao/callback
|
|
||||||
TEAMBITION:
|
|
||||||
client-id: 10**********6
|
|
||||||
client-secret: 1f7d08**********5b7**********29e
|
|
||||||
redirect-uri: http://oauth.xkcoding.com/demo/oauth/teambition/callback
|
|
||||||
RENREN:
|
|
||||||
client-id: 10**********6
|
|
||||||
client-secret: 1f7d08**********5b7**********29e
|
|
||||||
redirect-uri: http://oauth.xkcoding.com/demo/oauth/renren/callback
|
|
||||||
PINTEREST:
|
|
||||||
client-id: 10**********6
|
|
||||||
client-secret: 1f7d08**********5b7**********29e
|
|
||||||
redirect-uri: http://oauth.xkcoding.com/demo/oauth/pinterest/callback
|
|
||||||
STACK_OVERFLOW:
|
|
||||||
client-id: 10**********6
|
|
||||||
client-secret: 1f7d08**********5b7**********29e
|
|
||||||
redirect-uri: http://oauth.xkcoding.com/demo/oauth/stack_overflow/callback
|
|
||||||
stack-overflow-key: asd*********asd
|
|
||||||
HUAWEI:
|
|
||||||
client-id: 10**********6
|
|
||||||
client-secret: 1f7d08**********5b7**********29e
|
|
||||||
redirect-uri: http://oauth.xkcoding.com/demo/oauth/huawei/callback
|
|
||||||
KUJIALE:
|
|
||||||
client-id: 10**********6
|
|
||||||
client-secret: 1f7d08**********5b7**********29e
|
|
||||||
redirect-uri: http://oauth.xkcoding.com/demo/oauth/kujiale/callback
|
|
||||||
GITLAB:
|
|
||||||
client-id: 10**********6
|
|
||||||
client-secret: 1f7d08**********5b7**********29e
|
|
||||||
redirect-uri: http://oauth.xkcoding.com/demo/oauth/gitlab/callback
|
|
||||||
MEITUAN:
|
|
||||||
client-id: 10**********6
|
|
||||||
client-secret: 1f7d08**********5b7**********29e
|
|
||||||
redirect-uri: http://oauth.xkcoding.com/demo/oauth/meituan/callback
|
|
||||||
ELEME:
|
|
||||||
client-id: 10**********6
|
|
||||||
client-secret: 1f7d08**********5b7**********29e
|
|
||||||
redirect-uri: http://oauth.xkcoding.com/demo/oauth/eleme/callback
|
|
||||||
TWITTER:
|
|
||||||
client-id: 10**********6
|
|
||||||
client-secret: 1f7d08**********5b7**********29e
|
|
||||||
redirect-uri: http://oauth.xkcoding.com/demo/oauth/twitter/callback
|
|
||||||
XMLY:
|
|
||||||
client-id: 10**********6
|
|
||||||
client-secret: 1f7d08**********5b7**********29e
|
|
||||||
redirect-uri: http://oauth.xkcoding.com/demo/oauth/xmly/callback
|
|
||||||
# 设备唯一标识ID
|
|
||||||
device-id: xxxxxxxxxxxxxx
|
|
||||||
# 客户端操作系统类型,1-iOS系统,2-Android系统,3-Web
|
|
||||||
client-os-type: 3
|
|
||||||
# 客户端包名,如果 clientOsType 为1或2时必填。对Android客户端是包名,对IOS客户端是Bundle ID
|
|
||||||
#pack-id: xxxx
|
|
||||||
FEISHU:
|
|
||||||
client-id: 10**********6
|
|
||||||
client-secret: 1f7d08**********5b7**********29e
|
|
||||||
redirect-uri: http://oauth.xkcoding.com/demo/oauth/feishu/callback
|
|
||||||
JD:
|
|
||||||
client-id: 10**********6
|
|
||||||
client-secret: 1f7d08**********5b7**********29e
|
|
||||||
redirect-uri: http://oauth.xkcoding.com/demo/oauth/jd/callback
|
|
||||||
|
@ -180,3 +180,64 @@ sms:
|
|||||||
sdkAppId: appid
|
sdkAppId: appid
|
||||||
#地域信息默认为 ap-guangzhou 如无特殊改变可不用设置
|
#地域信息默认为 ap-guangzhou 如无特殊改变可不用设置
|
||||||
territory: ap-guangzhou
|
territory: ap-guangzhou
|
||||||
|
|
||||||
|
--- # 三方授权
|
||||||
|
justauth:
|
||||||
|
enabled: true
|
||||||
|
type:
|
||||||
|
qq:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://localhost:80/social-login?source=qq
|
||||||
|
union-id: false
|
||||||
|
weibo:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://localhost:80/social-login?source=weibo
|
||||||
|
gitee:
|
||||||
|
client-id: 914******************98
|
||||||
|
client-secret: 02*****************ac
|
||||||
|
redirect-uri: http://localhost:80/social-login?source=gitee
|
||||||
|
dingtalk:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://localhost:80/social-login?source=dingtalk
|
||||||
|
baidu:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://localhost:80/social-login?source=baidu
|
||||||
|
csdn:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://localhost:80/social-login?source=csdn
|
||||||
|
coding:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://localhost:80/social-login?source=coding
|
||||||
|
coding-group-name: xx
|
||||||
|
oschina:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://localhost:80/social-login?source=oschina
|
||||||
|
alipay:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://localhost:80/social-login?source=alipay
|
||||||
|
alipay-public-key: MIIB**************DAQAB
|
||||||
|
wechat_open:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://localhost:80/social-login?source=wechat_open
|
||||||
|
wechat_mp:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://localhost:80/social-login?source=wechat_mp
|
||||||
|
wechat_enterprise:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://localhost:80/social-login?source=wechat_enterprise
|
||||||
|
agent-id: 1000002
|
||||||
|
gitlab:
|
||||||
|
client-id: 10**********6
|
||||||
|
client-secret: 1f7d08**********5b7**********29e
|
||||||
|
redirect-uri: http://localhost:80/social-login?source=gitlab
|
||||||
|
@ -4,7 +4,6 @@ import me.zhyd.oauth.cache.AuthStateCache;
|
|||||||
import org.dromara.common.social.config.properties.SocialProperties;
|
import org.dromara.common.social.config.properties.SocialProperties;
|
||||||
import org.dromara.common.social.utils.AuthRedisStateCache;
|
import org.dromara.common.social.utils.AuthRedisStateCache;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
|
||||||
@ -17,8 +16,8 @@ import org.springframework.context.annotation.Bean;
|
|||||||
public class SocialConfig {
|
public class SocialConfig {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public AuthStateCache authStateCache() {
|
public AuthStateCache authStateCache(SocialProperties socialProperties) {
|
||||||
return new AuthRedisStateCache();
|
return new AuthRedisStateCache(socialProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,11 @@ package org.dromara.common.social.config.properties;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社交登录配置
|
||||||
|
*
|
||||||
|
* @author thiszhc
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class SocialLoginConfigProperties {
|
public class SocialLoginConfigProperties {
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Social 配置属性
|
* Social 配置属性
|
||||||
|
*
|
||||||
* @author thiszhc
|
* @author thiszhc
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@ -1,18 +1,16 @@
|
|||||||
package org.dromara.common.social.utils;
|
package org.dromara.common.social.utils;
|
||||||
|
|
||||||
import jakarta.annotation.PostConstruct;
|
import lombok.AllArgsConstructor;
|
||||||
import me.zhyd.oauth.cache.AuthStateCache;
|
import me.zhyd.oauth.cache.AuthStateCache;
|
||||||
import org.dromara.common.redis.utils.RedisUtils;
|
import org.dromara.common.redis.utils.RedisUtils;
|
||||||
import org.dromara.common.social.config.properties.SocialProperties;
|
import org.dromara.common.social.config.properties.SocialProperties;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
|
||||||
import org.springframework.data.redis.core.ValueOperations;
|
|
||||||
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
public class AuthRedisStateCache implements AuthStateCache {
|
public class AuthRedisStateCache implements AuthStateCache {
|
||||||
|
|
||||||
private SocialProperties socialProperties;
|
private final SocialProperties socialProperties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 存入缓存
|
* 存入缓存
|
||||||
@ -22,7 +20,6 @@ public class AuthRedisStateCache implements AuthStateCache {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void cache(String key, String value) {
|
public void cache(String key, String value) {
|
||||||
// TODO: 自定义存入缓存
|
|
||||||
RedisUtils.setCacheObject(key, value, Duration.ofMillis(socialProperties.getTimeout()));
|
RedisUtils.setCacheObject(key, value, Duration.ofMillis(socialProperties.getTimeout()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,7 +32,6 @@ public class AuthRedisStateCache implements AuthStateCache {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void cache(String key, String value, long timeout) {
|
public void cache(String key, String value, long timeout) {
|
||||||
// TODO: 自定义存入缓存
|
|
||||||
RedisUtils.setCacheObject(key, value, Duration.ofMillis(timeout));
|
RedisUtils.setCacheObject(key, value, Duration.ofMillis(timeout));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -47,7 +43,6 @@ public class AuthRedisStateCache implements AuthStateCache {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String get(String key) {
|
public String get(String key) {
|
||||||
// TODO: 自定义获取缓存内容
|
|
||||||
return RedisUtils.getCacheObject(key);
|
return RedisUtils.getCacheObject(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +54,6 @@ public class AuthRedisStateCache implements AuthStateCache {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public boolean containsKey(String key) {
|
public boolean containsKey(String key) {
|
||||||
// TODO: 自定义判断key是否存在
|
|
||||||
return RedisUtils.hasKey(key);
|
return RedisUtils.hasKey(key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package org.dromara.common.social.utils;
|
package org.dromara.common.social.utils;
|
||||||
|
|
||||||
import me.zhyd.oauth.cache.AuthStateCache;
|
|
||||||
import me.zhyd.oauth.config.AuthConfig;
|
import me.zhyd.oauth.config.AuthConfig;
|
||||||
import me.zhyd.oauth.exception.AuthException;
|
import me.zhyd.oauth.exception.AuthException;
|
||||||
import me.zhyd.oauth.request.*;
|
import me.zhyd.oauth.request.*;
|
||||||
@ -12,10 +11,8 @@ import me.zhyd.oauth.request.*;
|
|||||||
*/
|
*/
|
||||||
public class SocialUtils {
|
public class SocialUtils {
|
||||||
|
|
||||||
public static AuthRequest getAuthRequest(String source,
|
public static AuthRequest getAuthRequest(String source, String clientId,
|
||||||
String clientId,
|
String clientSecret, String redirectUri) throws AuthException {
|
||||||
String clientSecret,
|
|
||||||
String redirectUri) throws AuthException {
|
|
||||||
AuthRequest authRequest = null;
|
AuthRequest authRequest = null;
|
||||||
switch (source.toLowerCase()) {
|
switch (source.toLowerCase()) {
|
||||||
case "dingtalk" ->
|
case "dingtalk" ->
|
||||||
|
@ -3,9 +3,10 @@ package org.dromara.system.controller.system;
|
|||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.common.core.domain.R;
|
import org.dromara.common.core.domain.R;
|
||||||
|
import org.dromara.common.satoken.utils.LoginHelper;
|
||||||
import org.dromara.common.web.core.BaseController;
|
import org.dromara.common.web.core.BaseController;
|
||||||
import org.dromara.system.domain.vo.SocialUserVo;
|
import org.dromara.system.domain.vo.SysSocialVo;
|
||||||
import org.dromara.system.service.ISocialUserService;
|
import org.dromara.system.service.ISysSocialService;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
@ -24,18 +25,16 @@ import java.util.List;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/system/social")
|
@RequestMapping("/system/social")
|
||||||
public class SocialUserController extends BaseController {
|
public class SysSocialController extends BaseController {
|
||||||
|
|
||||||
private final ISocialUserService socialUserService;
|
private final ISysSocialService socialUserService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询社会化关系列表
|
* 查询社会化关系列表
|
||||||
*/
|
*/
|
||||||
// 这里改成用户默认的。只能查看自己的权限更好哦
|
|
||||||
// @SaCheckPermission("system:user:list")
|
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public R<List<SocialUserVo>> list() {
|
public R<List<SysSocialVo>> list() {
|
||||||
return R.ok(socialUserService.queryList());
|
return R.ok(socialUserService.queryListByUserId(LoginHelper.getUserId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -44,14 +43,10 @@ public class SocialUserController extends BaseController {
|
|||||||
*
|
*
|
||||||
* @param id 主键
|
* @param id 主键
|
||||||
*/
|
*/
|
||||||
// 这里改成用户默认的。只能查看自己的权限更好哦
|
|
||||||
// @SaCheckPermission("system:user:query")
|
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public R<SocialUserVo> getInfo(@NotNull(message = "主键不能为空")
|
public R<SysSocialVo> getInfo(@NotNull(message = "主键不能为空")
|
||||||
@PathVariable String id) {
|
@PathVariable String id) {
|
||||||
return R.ok(socialUserService.queryById(id));
|
return R.ok(socialUserService.queryById(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -1,22 +1,22 @@
|
|||||||
package org.dromara.system.domain;
|
package org.dromara.system.domain;
|
||||||
|
|
||||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.dromara.common.tenant.core.TenantEntity;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 社会化关系对象 social_user
|
* 社会化关系对象 sys_social
|
||||||
*
|
*
|
||||||
* @author thiszhc
|
* @author thiszhc
|
||||||
* @date 2023-06-12
|
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@TableName("social_user")
|
@TableName("sys_social")
|
||||||
public class SocialUser extends BaseEntity {
|
public class SysSocial extends TenantEntity {
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
@ -1,25 +1,26 @@
|
|||||||
package org.dromara.system.domain.bo;
|
package org.dromara.system.domain.bo;
|
||||||
|
|
||||||
import org.dromara.common.tenant.core.TenantEntity;
|
|
||||||
import org.dromara.system.domain.SocialUser;
|
|
||||||
import org.dromara.common.mybatis.core.domain.BaseEntity;
|
|
||||||
import org.dromara.common.core.validate.AddGroup;
|
|
||||||
import org.dromara.common.core.validate.EditGroup;
|
|
||||||
import io.github.linpeilie.annotations.AutoMapper;
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import jakarta.validation.constraints.*;
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.dromara.common.core.validate.AddGroup;
|
||||||
|
import org.dromara.common.core.validate.EditGroup;
|
||||||
|
import org.dromara.common.tenant.core.TenantEntity;
|
||||||
|
import org.dromara.system.domain.SysSocial;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 社会化关系业务对象 social_user
|
* 社会化关系业务对象 sys_social
|
||||||
*
|
*
|
||||||
* @author Lion Li
|
* @author Lion Li
|
||||||
* @date 2023-06-12
|
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@AutoMapper(target = SocialUser.class, reverseConvertGenerate = false)
|
@AutoMapper(target = SysSocial.class, reverseConvertGenerate = false)
|
||||||
public class SocialUserBo extends TenantEntity {
|
public class SysSocialBo extends TenantEntity {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 主键
|
* 主键
|
@ -4,23 +4,21 @@ import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
|||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import io.github.linpeilie.annotations.AutoMapper;
|
import io.github.linpeilie.annotations.AutoMapper;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.dromara.common.tenant.core.TenantEntity;
|
import org.dromara.system.domain.SysSocial;
|
||||||
import org.dromara.system.domain.SocialUser;
|
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 社会化关系视图对象 social_user
|
* 社会化关系视图对象 sys_social
|
||||||
*
|
*
|
||||||
* @author thiszhc
|
* @author thiszhc
|
||||||
* @date 2023-06-12
|
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@ExcelIgnoreUnannotated
|
@ExcelIgnoreUnannotated
|
||||||
@AutoMapper(target = SocialUser.class)
|
@AutoMapper(target = SysSocial.class)
|
||||||
public class SocialUserVo extends TenantEntity {
|
public class SysSocialVo implements Serializable {
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@ -31,6 +29,11 @@ public class SocialUserVo extends TenantEntity {
|
|||||||
@ExcelProperty(value = "主键")
|
@ExcelProperty(value = "主键")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户ID
|
||||||
|
*/
|
||||||
|
private String tenantId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 的唯一ID
|
* 的唯一ID
|
||||||
*/
|
*/
|
@ -1,23 +0,0 @@
|
|||||||
package org.dromara.system.mapper;
|
|
||||||
|
|
||||||
import org.dromara.system.domain.SocialUser;
|
|
||||||
import org.dromara.system.domain.bo.SysUserBo;
|
|
||||||
import org.dromara.system.domain.vo.SocialUserVo;
|
|
||||||
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 社会化关系Mapper接口
|
|
||||||
*
|
|
||||||
* @author thiszhc
|
|
||||||
* @date 2023-06-12
|
|
||||||
*/
|
|
||||||
public interface SocialUserMapper extends BaseMapperPlus<SocialUser, SocialUserVo> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据authId查询SocialUser表和SysUser表,返回SocialUserAuthResult映射的对象
|
|
||||||
* @param authId 认证ID
|
|
||||||
* @return SocialUser
|
|
||||||
*/
|
|
||||||
SocialUserVo selectSocialUserByAuthId(String authId);
|
|
||||||
|
|
||||||
}
|
|
@ -0,0 +1,22 @@
|
|||||||
|
package org.dromara.system.mapper;
|
||||||
|
|
||||||
|
import org.dromara.common.mybatis.core.mapper.BaseMapperPlus;
|
||||||
|
import org.dromara.system.domain.SysSocial;
|
||||||
|
import org.dromara.system.domain.vo.SysSocialVo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社会化关系Mapper接口
|
||||||
|
*
|
||||||
|
* @author thiszhc
|
||||||
|
*/
|
||||||
|
public interface SysSocialMapper extends BaseMapperPlus<SysSocial, SysSocialVo> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据 authId 查询 SysSocial 表和 SysUser 表,返回 SysSocialAuthResult 映射的对象
|
||||||
|
*
|
||||||
|
* @param authId 认证ID
|
||||||
|
* @return SysSocial
|
||||||
|
*/
|
||||||
|
SysSocialVo selectByAuthId(String authId);
|
||||||
|
|
||||||
|
}
|
@ -1,46 +0,0 @@
|
|||||||
package org.dromara.system.service;
|
|
||||||
|
|
||||||
import org.dromara.system.domain.bo.SocialUserBo;
|
|
||||||
import org.dromara.system.domain.vo.SocialUserVo;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 社会化关系Service接口
|
|
||||||
*
|
|
||||||
* @author thiszhc
|
|
||||||
* @date 2023-06-12
|
|
||||||
*/
|
|
||||||
public interface ISocialUserService {
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询社会化关系
|
|
||||||
*/
|
|
||||||
SocialUserVo queryById(String id);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询社会化关系列表
|
|
||||||
*/
|
|
||||||
List<SocialUserVo> queryList();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增授权关系
|
|
||||||
*/
|
|
||||||
Boolean insertByBo(SocialUserBo bo);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除社会化关系信息
|
|
||||||
*/
|
|
||||||
Boolean deleteWithValidById(Long id);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据authId查询SocialUser表和SysUser表,返回SocialUserAuthResult映射的对象
|
|
||||||
* @param authId 认证ID
|
|
||||||
* @return SocialUser
|
|
||||||
*/
|
|
||||||
SocialUserVo selectSocialUserByAuthId(String authId);
|
|
||||||
|
|
||||||
}
|
|
@ -0,0 +1,51 @@
|
|||||||
|
package org.dromara.system.service;
|
||||||
|
|
||||||
|
import org.dromara.system.domain.bo.SysSocialBo;
|
||||||
|
import org.dromara.system.domain.vo.SysSocialVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 社会化关系Service接口
|
||||||
|
*
|
||||||
|
* @author thiszhc
|
||||||
|
*/
|
||||||
|
public interface ISysSocialService {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询社会化关系
|
||||||
|
*/
|
||||||
|
SysSocialVo queryById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询社会化关系列表
|
||||||
|
*/
|
||||||
|
List<SysSocialVo> queryList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询社会化关系列表
|
||||||
|
*/
|
||||||
|
List<SysSocialVo> queryListByUserId(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增授权关系
|
||||||
|
*/
|
||||||
|
Boolean insertByBo(SysSocialBo bo);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除社会化关系信息
|
||||||
|
*/
|
||||||
|
Boolean deleteWithValidById(Long id);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据 authId 查询 SysSocial 表和 SysUser 表,返回 SysSocialAuthResult 映射的对象
|
||||||
|
* @param authId 认证ID
|
||||||
|
* @return SysSocial
|
||||||
|
*/
|
||||||
|
SysSocialVo selectByAuthId(String authId);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,12 +1,13 @@
|
|||||||
package org.dromara.system.service.impl;
|
package org.dromara.system.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.common.core.utils.MapstructUtils;
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
import org.dromara.system.domain.SocialUser;
|
import org.dromara.system.domain.SysSocial;
|
||||||
import org.dromara.system.domain.bo.SocialUserBo;
|
import org.dromara.system.domain.bo.SysSocialBo;
|
||||||
import org.dromara.system.domain.vo.SocialUserVo;
|
import org.dromara.system.domain.vo.SysSocialVo;
|
||||||
import org.dromara.system.mapper.SocialUserMapper;
|
import org.dromara.system.mapper.SysSocialMapper;
|
||||||
import org.dromara.system.service.ISocialUserService;
|
import org.dromara.system.service.ISysSocialService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -19,16 +20,16 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Service
|
@Service
|
||||||
public class SocialUserServiceImpl implements ISocialUserService {
|
public class SysSocialServiceImpl implements ISysSocialService {
|
||||||
|
|
||||||
private final SocialUserMapper baseMapper;
|
private final SysSocialMapper baseMapper;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询社会化关系
|
* 查询社会化关系
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SocialUserVo queryById(String id){
|
public SysSocialVo queryById(String id) {
|
||||||
return baseMapper.selectVoById(id);
|
return baseMapper.selectVoById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,18 +37,22 @@ public class SocialUserServiceImpl implements ISocialUserService {
|
|||||||
* 授权列表
|
* 授权列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<SocialUserVo> queryList() {
|
public List<SysSocialVo> queryList() {
|
||||||
return baseMapper.selectVoList();
|
return baseMapper.selectVoList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SysSocialVo> queryListByUserId(Long userId) {
|
||||||
|
return baseMapper.selectVoList(new LambdaQueryWrapper<SysSocial>().eq(SysSocial::getUserId, userId));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增社会化关系
|
* 新增社会化关系
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean insertByBo(SocialUserBo bo) {
|
public Boolean insertByBo(SysSocialBo bo) {
|
||||||
SocialUser add = MapstructUtils.convert(bo, SocialUser.class);
|
SysSocial add = MapstructUtils.convert(bo, SysSocial.class);
|
||||||
validEntityBeforeSave(add);
|
validEntityBeforeSave(add);
|
||||||
boolean flag = baseMapper.insert(add) > 0;
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
if (flag) {
|
if (flag) {
|
||||||
@ -64,7 +69,7 @@ public class SocialUserServiceImpl implements ISocialUserService {
|
|||||||
/**
|
/**
|
||||||
* 保存前的数据校验
|
* 保存前的数据校验
|
||||||
*/
|
*/
|
||||||
private void validEntityBeforeSave(SocialUser entity) {
|
private void validEntityBeforeSave(SysSocial entity) {
|
||||||
//TODO 做一些数据校验,如唯一约束
|
//TODO 做一些数据校验,如唯一约束
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -85,8 +90,8 @@ public class SocialUserServiceImpl implements ISocialUserService {
|
|||||||
* @return 用户信息
|
* @return 用户信息
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public SocialUserVo selectSocialUserByAuthId(String authId) {
|
public SysSocialVo selectByAuthId(String authId) {
|
||||||
return baseMapper.selectSocialUserByAuthId(authId);
|
return baseMapper.selectByAuthId(authId);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -2,21 +2,20 @@
|
|||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="org.dromara.system.mapper.SocialUserMapper">
|
<mapper namespace="org.dromara.system.mapper.SysSocialMapper">
|
||||||
|
|
||||||
<resultMap type="org.dromara.system.domain.vo.SocialUserVo" id="SocialUserAuthResult">
|
<resultMap type="org.dromara.system.domain.vo.SysSocialVo" id="SysSocialAuthResult">
|
||||||
<id property="id" column="id"/>
|
<id property="id" column="id"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<!-- 根据authId查询SocialUser表和SysUser表,返回SocialUserAuthResult映射的对象 -->
|
<select id="selectByAuthId" parameterType="String" resultMap="SysSocialAuthResult">
|
||||||
<select id="selectSocialUserByAuthId" parameterType="String" resultMap="SocialUserAuthResult">
|
|
||||||
select b.user_id,
|
select b.user_id,
|
||||||
b.tenant_id,
|
b.tenant_id,
|
||||||
b.user_name,
|
b.user_name,
|
||||||
b.password,
|
b.password,
|
||||||
a.auth_id,
|
a.auth_id,
|
||||||
a.source
|
a.source
|
||||||
from social_user a
|
from sys_social a
|
||||||
left join sys_user b on a.user_id = b.user_id
|
left join sys_user b on a.user_id = b.user_id
|
||||||
where a.auth_id = #{authId}
|
where a.auth_id = #{authId}
|
||||||
</select>
|
</select>
|
@ -1,3 +1,73 @@
|
|||||||
|
-- ----------------------------
|
||||||
|
-- 第三方平台授权表
|
||||||
|
-- ----------------------------
|
||||||
|
create table sys_social
|
||||||
|
(
|
||||||
|
id number(20) not null,
|
||||||
|
user_id number(20) not null,
|
||||||
|
tenant_id varchar(20) default null,
|
||||||
|
auth_id varchar(255) not null,
|
||||||
|
source varchar(255) not null,
|
||||||
|
open_id varchar(255) default null,
|
||||||
|
user_name varchar(30) not null,
|
||||||
|
nick_name varchar(30) default '',
|
||||||
|
email varchar(255) default '',
|
||||||
|
avatar varchar(500) default '',
|
||||||
|
access_token varchar(255) not null,
|
||||||
|
expire_in number(100) default null,
|
||||||
|
refresh_token varchar(255) default null,
|
||||||
|
access_code varchar(255) default null,
|
||||||
|
union_id varchar(255) default null,
|
||||||
|
scope varchar(255) default null,
|
||||||
|
token_type varchar(255) default null,
|
||||||
|
id_token varchar(255) default null,
|
||||||
|
mac_algorithm varchar(255) default null,
|
||||||
|
mac_key varchar(255) default null,
|
||||||
|
code varchar(255) default null,
|
||||||
|
oauth_token varchar(255) default null,
|
||||||
|
oauth_token_secret varchar(255) default null,
|
||||||
|
create_dept number(20),
|
||||||
|
create_by number(20),
|
||||||
|
create_time date,
|
||||||
|
update_by number(20),
|
||||||
|
update_time date,
|
||||||
|
del_flag char(1) default '0'
|
||||||
|
);
|
||||||
|
|
||||||
|
alter table sys_social add constraint pk_sys_social primary key (id);
|
||||||
|
|
||||||
|
comment on table sys_social is '社会化关系表';
|
||||||
|
comment on column sys_social.id is '主键';
|
||||||
|
comment on column sys_social.user_id is '用户ID';
|
||||||
|
comment on column sys_social.tenant_id is '租户id';
|
||||||
|
comment on column sys_social.auth_id is '授权+授权openid';
|
||||||
|
comment on column sys_social.source is '用户来源';
|
||||||
|
comment on column sys_social.open_id is '原生openid';
|
||||||
|
comment on column sys_social.user_name is '登录账号';
|
||||||
|
comment on column sys_social.nick_name is '用户昵称';
|
||||||
|
comment on column sys_social.email is '用户邮箱';
|
||||||
|
comment on column sys_social.avatar is '头像地址';
|
||||||
|
comment on column sys_social.access_token is '用户的授权令牌';
|
||||||
|
comment on column sys_social.expire_in is '用户的授权令牌的有效期,部分平台可能没有';
|
||||||
|
comment on column sys_social.refresh_token is '刷新令牌,部分平台可能没有';
|
||||||
|
comment on column sys_social.access_code is '平台的授权信息,部分平台可能没有';
|
||||||
|
comment on column sys_social.union_id is '用户的 unionid';
|
||||||
|
comment on column sys_social.scope is '授予的权限,部分平台可能没有';
|
||||||
|
comment on column sys_social.token_type is '个别平台的授权信息,部分平台可能没有';
|
||||||
|
comment on column sys_social.id_token is 'id token,部分平台可能没有';
|
||||||
|
comment on column sys_social.mac_algorithm is '小米平台用户的附带属性,部分平台可能没有';
|
||||||
|
comment on column sys_social.mac_key is '小米平台用户的附带属性,部分平台可能没有';
|
||||||
|
comment on column sys_social.code is '用户的授权code,部分平台可能没有';
|
||||||
|
comment on column sys_social.oauth_token is 'Twitter平台用户的附带属性,部分平台可能没有';
|
||||||
|
comment on column sys_social.oauth_token_secret is 'Twitter平台用户的附带属性,部分平台可能没有';
|
||||||
|
comment on column sys_social.create_dept is '创建部门';
|
||||||
|
comment on column sys_social.create_by is '创建者';
|
||||||
|
comment on column sys_social.create_time is '创建时间';
|
||||||
|
comment on column sys_social.update_by is '更新者';
|
||||||
|
comment on column sys_social.update_time is '更新时间';
|
||||||
|
comment on column sys_social.del_flag is '删除标志(0代表存在 2代表删除)';
|
||||||
|
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- 租户表
|
-- 租户表
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
|
@ -1,3 +1,71 @@
|
|||||||
|
-- ----------------------------
|
||||||
|
-- 第三方平台授权表
|
||||||
|
-- ----------------------------
|
||||||
|
create table sys_social
|
||||||
|
(
|
||||||
|
id int8 not null,
|
||||||
|
user_id int8 not null,
|
||||||
|
tenant_id varchar(20) default null::varchar,
|
||||||
|
auth_id varchar(255) not null,
|
||||||
|
source varchar(255) not null,
|
||||||
|
open_id varchar(255) default null::varchar,
|
||||||
|
user_name varchar(30) not null,
|
||||||
|
nick_name varchar(30) default ''::varchar,
|
||||||
|
email varchar(255) default ''::varchar,
|
||||||
|
avatar varchar(500) default ''::varchar,
|
||||||
|
access_token varchar(255) not null,
|
||||||
|
expire_in int8 default null::varchar,
|
||||||
|
refresh_token varchar(255) default null::varchar,
|
||||||
|
access_code varchar(255) default null::varchar,
|
||||||
|
union_id varchar(255) default null::varchar,
|
||||||
|
scope varchar(255) default null::varchar,
|
||||||
|
token_type varchar(255) default null::varchar,
|
||||||
|
id_token varchar(255) default null::varchar,
|
||||||
|
mac_algorithm varchar(255) default null::varchar,
|
||||||
|
mac_key varchar(255) default null::varchar,
|
||||||
|
code varchar(255) default null::varchar,
|
||||||
|
oauth_token varchar(255) default null::varchar,
|
||||||
|
oauth_token_secret varchar(255) default null::varchar,
|
||||||
|
create_dept int8,
|
||||||
|
create_by int8,
|
||||||
|
create_time timestamp,
|
||||||
|
update_by int8,
|
||||||
|
update_time timestamp,
|
||||||
|
del_flag char default '0'::bpchar,
|
||||||
|
constraint "pk_sys_social" primary key (id)
|
||||||
|
);
|
||||||
|
|
||||||
|
comment on table sys_social is '社会化关系表';
|
||||||
|
comment on column sys_social.id is '主键';
|
||||||
|
comment on column sys_social.user_id is '用户ID';
|
||||||
|
comment on column sys_social.tenant_id is '租户id';
|
||||||
|
comment on column sys_social.auth_id is '授权+授权openid';
|
||||||
|
comment on column sys_social.source is '用户来源';
|
||||||
|
comment on column sys_social.open_id is '原生openid';
|
||||||
|
comment on column sys_social.user_name is '登录账号';
|
||||||
|
comment on column sys_social.nick_name is '用户昵称';
|
||||||
|
comment on column sys_social.email is '用户邮箱';
|
||||||
|
comment on column sys_social.avatar is '头像地址';
|
||||||
|
comment on column sys_social.access_token is '用户的授权令牌';
|
||||||
|
comment on column sys_social.expire_in is '用户的授权令牌的有效期,部分平台可能没有';
|
||||||
|
comment on column sys_social.refresh_token is '刷新令牌,部分平台可能没有';
|
||||||
|
comment on column sys_social.access_code is '平台的授权信息,部分平台可能没有';
|
||||||
|
comment on column sys_social.union_id is '用户的 unionid';
|
||||||
|
comment on column sys_social.scope is '授予的权限,部分平台可能没有';
|
||||||
|
comment on column sys_social.token_type is '个别平台的授权信息,部分平台可能没有';
|
||||||
|
comment on column sys_social.id_token is 'id token,部分平台可能没有';
|
||||||
|
comment on column sys_social.mac_algorithm is '小米平台用户的附带属性,部分平台可能没有';
|
||||||
|
comment on column sys_social.mac_key is '小米平台用户的附带属性,部分平台可能没有';
|
||||||
|
comment on column sys_social.code is '用户的授权code,部分平台可能没有';
|
||||||
|
comment on column sys_social.oauth_token is 'Twitter平台用户的附带属性,部分平台可能没有';
|
||||||
|
comment on column sys_social.oauth_token_secret is 'Twitter平台用户的附带属性,部分平台可能没有';
|
||||||
|
comment on column sys_social.create_dept is '创建部门';
|
||||||
|
comment on column sys_social.create_by is '创建者';
|
||||||
|
comment on column sys_social.create_time is '创建时间';
|
||||||
|
comment on column sys_social.update_by is '更新者';
|
||||||
|
comment on column sys_social.update_time is '更新时间';
|
||||||
|
comment on column sys_social.del_flag is '删除标志(0代表存在 2代表删除)';
|
||||||
|
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
-- 租户表
|
-- 租户表
|
||||||
-- ----------------------------
|
-- ----------------------------
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,3 +1,223 @@
|
|||||||
|
create table sys_social
|
||||||
|
(
|
||||||
|
id bigint NOT NULL,
|
||||||
|
user_id bigint NOT NULL,
|
||||||
|
tenant_id nvarchar(20) NULL,
|
||||||
|
auth_id nvarchar(255) NOT NULL,
|
||||||
|
source nvarchar(255) NOT NULL,
|
||||||
|
open_id nvarchar(255) NULL,
|
||||||
|
user_name nvarchar(30) NOT NULL,
|
||||||
|
nick_name nvarchar(30) DEFAULT ('') NULL,
|
||||||
|
email nvarchar(255) DEFAULT ('') NULL,
|
||||||
|
avatar nvarchar(500) DEFAULT ('') NULL,
|
||||||
|
access_token nvarchar(255) NOT NULL,
|
||||||
|
expire_in bigint NULL,
|
||||||
|
refresh_token nvarchar(255) NULL,
|
||||||
|
access_code nvarchar(255) NULL,
|
||||||
|
union_id nvarchar(255) NULL,
|
||||||
|
scope nvarchar(255) NULL,
|
||||||
|
token_type nvarchar(255) NULL,
|
||||||
|
id_token nvarchar(255) NULL,
|
||||||
|
mac_algorithm nvarchar(255) NULL,
|
||||||
|
mac_key nvarchar(255) NULL,
|
||||||
|
code nvarchar(255) NULL,
|
||||||
|
oauth_token nvarchar(255) NULL,
|
||||||
|
oauth_token_secret nvarchar(255) NULL,
|
||||||
|
create_dept bigint,
|
||||||
|
create_by bigint,
|
||||||
|
create_time datetime2(7),
|
||||||
|
update_by bigint,
|
||||||
|
update_time datetime2(7),
|
||||||
|
del_flag nchar DEFAULT ('0') NULL,
|
||||||
|
CONSTRAINT PK__sys_social__B21E8F2427725F8A PRIMARY KEY CLUSTERED (id)
|
||||||
|
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
|
||||||
|
ON [PRIMARY]
|
||||||
|
)
|
||||||
|
ON [PRIMARY]
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'id' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'id'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'主键' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'id'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'用户ID' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'user_id'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'租户id' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'tenant_id'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'授权+授权openid' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'auth_id'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'用户来源' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'source'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'原生openid' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'open_id'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'登录账号' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'user_name'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'用户昵称' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'nick_name'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'用户邮箱' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'email'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'头像地址' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'avatar'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'用户的授权令牌' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'access_token'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'用户的授权令牌的有效期,部分平台可能没有' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'expire_in'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'刷新令牌,部分平台可能没有' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'refresh_token'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'平台的授权信息,部分平台可能没有' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'access_code'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'用户的 unionid' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'union_id'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'授予的权限,部分平台可能没有' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'scope'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'个别平台的授权信息,部分平台可能没有' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'token_type'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'id token,部分平台可能没有' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'id_token'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'小米平台用户的附带属性,部分平台可能没有' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'mac_algorithm'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'小米平台用户的附带属性,部分平台可能没有' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'mac_key'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'用户的授权code,部分平台可能没有' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'code'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'Twitter平台用户的附带属性,部分平台可能没有' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'oauth_token'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'Twitter平台用户的附带属性,部分平台可能没有' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'oauth_token_secret'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'删除标志(0代表存在 2代表删除)' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'del_flag'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'创建部门' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'create_dept'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'创建者' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'create_by'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'创建时间' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'create_time'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'更新者' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'update_by'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'更新时间' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'update_time'
|
||||||
|
GO
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE sys_tenant
|
CREATE TABLE sys_tenant
|
||||||
(
|
(
|
||||||
id bigint NOT NULL,
|
id bigint NOT NULL,
|
||||||
|
@ -3,3 +3,72 @@ ALTER TABLE gen_table ADD (data_name VARCHAR2(200) DEFAULT '');
|
|||||||
COMMENT ON COLUMN gen_table.data_name IS '数据源名称';
|
COMMENT ON COLUMN gen_table.data_name IS '数据源名称';
|
||||||
|
|
||||||
UPDATE sys_menu SET path = 'powerjob', component = 'monitor/powerjob/index', perms = 'monitor:powerjob:list', remark = 'powerjob控制台菜单' WHERE menu_id = 120;
|
UPDATE sys_menu SET path = 'powerjob', component = 'monitor/powerjob/index', perms = 'monitor:powerjob:list', remark = 'powerjob控制台菜单' WHERE menu_id = 120;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 第三方平台授权表
|
||||||
|
-- ----------------------------
|
||||||
|
create table sys_social
|
||||||
|
(
|
||||||
|
id number(20) not null,
|
||||||
|
user_id number(20) not null,
|
||||||
|
tenant_id varchar(20) default null,
|
||||||
|
auth_id varchar(255) not null,
|
||||||
|
source varchar(255) not null,
|
||||||
|
open_id varchar(255) default null,
|
||||||
|
user_name varchar(30) not null,
|
||||||
|
nick_name varchar(30) default '',
|
||||||
|
email varchar(255) default '',
|
||||||
|
avatar varchar(500) default '',
|
||||||
|
access_token varchar(255) not null,
|
||||||
|
expire_in number(100) default null,
|
||||||
|
refresh_token varchar(255) default null,
|
||||||
|
access_code varchar(255) default null,
|
||||||
|
union_id varchar(255) default null,
|
||||||
|
scope varchar(255) default null,
|
||||||
|
token_type varchar(255) default null,
|
||||||
|
id_token varchar(255) default null,
|
||||||
|
mac_algorithm varchar(255) default null,
|
||||||
|
mac_key varchar(255) default null,
|
||||||
|
code varchar(255) default null,
|
||||||
|
oauth_token varchar(255) default null,
|
||||||
|
oauth_token_secret varchar(255) default null,
|
||||||
|
create_dept number(20),
|
||||||
|
create_by number(20),
|
||||||
|
create_time date,
|
||||||
|
update_by number(20),
|
||||||
|
update_time date,
|
||||||
|
del_flag char(1) default '0'
|
||||||
|
);
|
||||||
|
|
||||||
|
alter table sys_social add constraint pk_sys_social primary key (id);
|
||||||
|
|
||||||
|
comment on table sys_social is '社会化关系表';
|
||||||
|
comment on column sys_social.id is '主键';
|
||||||
|
comment on column sys_social.user_id is '用户ID';
|
||||||
|
comment on column sys_social.tenant_id is '租户id';
|
||||||
|
comment on column sys_social.auth_id is '授权+授权openid';
|
||||||
|
comment on column sys_social.source is '用户来源';
|
||||||
|
comment on column sys_social.open_id is '原生openid';
|
||||||
|
comment on column sys_social.user_name is '登录账号';
|
||||||
|
comment on column sys_social.nick_name is '用户昵称';
|
||||||
|
comment on column sys_social.email is '用户邮箱';
|
||||||
|
comment on column sys_social.avatar is '头像地址';
|
||||||
|
comment on column sys_social.access_token is '用户的授权令牌';
|
||||||
|
comment on column sys_social.expire_in is '用户的授权令牌的有效期,部分平台可能没有';
|
||||||
|
comment on column sys_social.refresh_token is '刷新令牌,部分平台可能没有';
|
||||||
|
comment on column sys_social.access_code is '平台的授权信息,部分平台可能没有';
|
||||||
|
comment on column sys_social.union_id is '用户的 unionid';
|
||||||
|
comment on column sys_social.scope is '授予的权限,部分平台可能没有';
|
||||||
|
comment on column sys_social.token_type is '个别平台的授权信息,部分平台可能没有';
|
||||||
|
comment on column sys_social.id_token is 'id token,部分平台可能没有';
|
||||||
|
comment on column sys_social.mac_algorithm is '小米平台用户的附带属性,部分平台可能没有';
|
||||||
|
comment on column sys_social.mac_key is '小米平台用户的附带属性,部分平台可能没有';
|
||||||
|
comment on column sys_social.code is '用户的授权code,部分平台可能没有';
|
||||||
|
comment on column sys_social.oauth_token is 'Twitter平台用户的附带属性,部分平台可能没有';
|
||||||
|
comment on column sys_social.oauth_token_secret is 'Twitter平台用户的附带属性,部分平台可能没有';
|
||||||
|
comment on column sys_social.create_dept is '创建部门';
|
||||||
|
comment on column sys_social.create_by is '创建者';
|
||||||
|
comment on column sys_social.create_time is '创建时间';
|
||||||
|
comment on column sys_social.update_by is '更新者';
|
||||||
|
comment on column sys_social.update_time is '更新时间';
|
||||||
|
comment on column sys_social.del_flag is '删除标志(0代表存在 2代表删除)';
|
||||||
|
@ -3,3 +3,71 @@ ALTER TABLE gen_table ADD data_name varchar(200) default ''::varchar;
|
|||||||
COMMENT ON COLUMN gen_table.data_name IS '数据源名称';
|
COMMENT ON COLUMN gen_table.data_name IS '数据源名称';
|
||||||
|
|
||||||
UPDATE sys_menu SET path = 'powerjob', component = 'monitor/powerjob/index', perms = 'monitor:powerjob:list', remark = 'powerjob控制台菜单' WHERE menu_id = 120;
|
UPDATE sys_menu SET path = 'powerjob', component = 'monitor/powerjob/index', perms = 'monitor:powerjob:list', remark = 'powerjob控制台菜单' WHERE menu_id = 120;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 第三方平台授权表
|
||||||
|
-- ----------------------------
|
||||||
|
create table sys_social
|
||||||
|
(
|
||||||
|
id int8 not null,
|
||||||
|
user_id int8 not null,
|
||||||
|
tenant_id varchar(20) default null::varchar,
|
||||||
|
auth_id varchar(255) not null,
|
||||||
|
source varchar(255) not null,
|
||||||
|
open_id varchar(255) default null::varchar,
|
||||||
|
user_name varchar(30) not null,
|
||||||
|
nick_name varchar(30) default ''::varchar,
|
||||||
|
email varchar(255) default ''::varchar,
|
||||||
|
avatar varchar(500) default ''::varchar,
|
||||||
|
access_token varchar(255) not null,
|
||||||
|
expire_in int8 default null::varchar,
|
||||||
|
refresh_token varchar(255) default null::varchar,
|
||||||
|
access_code varchar(255) default null::varchar,
|
||||||
|
union_id varchar(255) default null::varchar,
|
||||||
|
scope varchar(255) default null::varchar,
|
||||||
|
token_type varchar(255) default null::varchar,
|
||||||
|
id_token varchar(255) default null::varchar,
|
||||||
|
mac_algorithm varchar(255) default null::varchar,
|
||||||
|
mac_key varchar(255) default null::varchar,
|
||||||
|
code varchar(255) default null::varchar,
|
||||||
|
oauth_token varchar(255) default null::varchar,
|
||||||
|
oauth_token_secret varchar(255) default null::varchar,
|
||||||
|
create_dept int8,
|
||||||
|
create_by int8,
|
||||||
|
create_time timestamp,
|
||||||
|
update_by int8,
|
||||||
|
update_time timestamp,
|
||||||
|
del_flag char default '0'::bpchar,
|
||||||
|
constraint "pk_sys_social" primary key (id)
|
||||||
|
);
|
||||||
|
|
||||||
|
comment on table sys_social is '社会化关系表';
|
||||||
|
comment on column sys_social.id is '主键';
|
||||||
|
comment on column sys_social.user_id is '用户ID';
|
||||||
|
comment on column sys_social.tenant_id is '租户id';
|
||||||
|
comment on column sys_social.auth_id is '授权+授权openid';
|
||||||
|
comment on column sys_social.source is '用户来源';
|
||||||
|
comment on column sys_social.open_id is '原生openid';
|
||||||
|
comment on column sys_social.user_name is '登录账号';
|
||||||
|
comment on column sys_social.nick_name is '用户昵称';
|
||||||
|
comment on column sys_social.email is '用户邮箱';
|
||||||
|
comment on column sys_social.avatar is '头像地址';
|
||||||
|
comment on column sys_social.access_token is '用户的授权令牌';
|
||||||
|
comment on column sys_social.expire_in is '用户的授权令牌的有效期,部分平台可能没有';
|
||||||
|
comment on column sys_social.refresh_token is '刷新令牌,部分平台可能没有';
|
||||||
|
comment on column sys_social.access_code is '平台的授权信息,部分平台可能没有';
|
||||||
|
comment on column sys_social.union_id is '用户的 unionid';
|
||||||
|
comment on column sys_social.scope is '授予的权限,部分平台可能没有';
|
||||||
|
comment on column sys_social.token_type is '个别平台的授权信息,部分平台可能没有';
|
||||||
|
comment on column sys_social.id_token is 'id token,部分平台可能没有';
|
||||||
|
comment on column sys_social.mac_algorithm is '小米平台用户的附带属性,部分平台可能没有';
|
||||||
|
comment on column sys_social.mac_key is '小米平台用户的附带属性,部分平台可能没有';
|
||||||
|
comment on column sys_social.code is '用户的授权code,部分平台可能没有';
|
||||||
|
comment on column sys_social.oauth_token is 'Twitter平台用户的附带属性,部分平台可能没有';
|
||||||
|
comment on column sys_social.oauth_token_secret is 'Twitter平台用户的附带属性,部分平台可能没有';
|
||||||
|
comment on column sys_social.create_dept is '创建部门';
|
||||||
|
comment on column sys_social.create_by is '创建者';
|
||||||
|
comment on column sys_social.create_time is '创建时间';
|
||||||
|
comment on column sys_social.update_by is '更新者';
|
||||||
|
comment on column sys_social.update_time is '更新时间';
|
||||||
|
comment on column sys_social.del_flag is '删除标志(0代表存在 2代表删除)';
|
||||||
|
@ -10,3 +10,222 @@ GO
|
|||||||
|
|
||||||
UPDATE sys_menu SET path = 'powerjob', component = 'monitor/powerjob/index', perms = 'monitor:powerjob:list', remark = 'powerjob控制台菜单' WHERE menu_id = 120
|
UPDATE sys_menu SET path = 'powerjob', component = 'monitor/powerjob/index', perms = 'monitor:powerjob:list', remark = 'powerjob控制台菜单' WHERE menu_id = 120
|
||||||
GO
|
GO
|
||||||
|
|
||||||
|
create table sys_social
|
||||||
|
(
|
||||||
|
id bigint NOT NULL,
|
||||||
|
user_id bigint NOT NULL,
|
||||||
|
tenant_id nvarchar(20) NULL,
|
||||||
|
auth_id nvarchar(255) NOT NULL,
|
||||||
|
source nvarchar(255) NOT NULL,
|
||||||
|
open_id nvarchar(255) NULL,
|
||||||
|
user_name nvarchar(30) NOT NULL,
|
||||||
|
nick_name nvarchar(30) DEFAULT ('') NULL,
|
||||||
|
email nvarchar(255) DEFAULT ('') NULL,
|
||||||
|
avatar nvarchar(500) DEFAULT ('') NULL,
|
||||||
|
access_token nvarchar(255) NOT NULL,
|
||||||
|
expire_in bigint NULL,
|
||||||
|
refresh_token nvarchar(255) NULL,
|
||||||
|
access_code nvarchar(255) NULL,
|
||||||
|
union_id nvarchar(255) NULL,
|
||||||
|
scope nvarchar(255) NULL,
|
||||||
|
token_type nvarchar(255) NULL,
|
||||||
|
id_token nvarchar(255) NULL,
|
||||||
|
mac_algorithm nvarchar(255) NULL,
|
||||||
|
mac_key nvarchar(255) NULL,
|
||||||
|
code nvarchar(255) NULL,
|
||||||
|
oauth_token nvarchar(255) NULL,
|
||||||
|
oauth_token_secret nvarchar(255) NULL,
|
||||||
|
create_dept bigint,
|
||||||
|
create_by bigint,
|
||||||
|
create_time datetime2(7),
|
||||||
|
update_by bigint,
|
||||||
|
update_time datetime2(7),
|
||||||
|
del_flag nchar DEFAULT ('0') NULL,
|
||||||
|
CONSTRAINT PK__sys_social__B21E8F2427725F8A PRIMARY KEY CLUSTERED (id)
|
||||||
|
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
|
||||||
|
ON [PRIMARY]
|
||||||
|
)
|
||||||
|
ON [PRIMARY]
|
||||||
|
GO
|
||||||
|
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'id' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'id'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'主键' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'id'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'用户ID' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'user_id'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'租户id' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'tenant_id'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'授权+授权openid' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'auth_id'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'用户来源' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'source'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'原生openid' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'open_id'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'登录账号' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'user_name'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'用户昵称' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'nick_name'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'用户邮箱' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'email'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'头像地址' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'avatar'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'用户的授权令牌' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'access_token'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'用户的授权令牌的有效期,部分平台可能没有' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'expire_in'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'刷新令牌,部分平台可能没有' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'refresh_token'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'平台的授权信息,部分平台可能没有' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'access_code'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'用户的 unionid' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'union_id'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'授予的权限,部分平台可能没有' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'scope'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'个别平台的授权信息,部分平台可能没有' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'token_type'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'id token,部分平台可能没有' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'id_token'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'小米平台用户的附带属性,部分平台可能没有' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'mac_algorithm'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'小米平台用户的附带属性,部分平台可能没有' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'mac_key'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'用户的授权code,部分平台可能没有' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'code'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'Twitter平台用户的附带属性,部分平台可能没有' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'oauth_token'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'Twitter平台用户的附带属性,部分平台可能没有' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'oauth_token_secret'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'删除标志(0代表存在 2代表删除)' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'del_flag'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'创建部门' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'create_dept'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'创建者' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'create_by'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'创建时间' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'create_time'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'更新者' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'update_by'
|
||||||
|
GO
|
||||||
|
EXEC sys.sp_addextendedproperty
|
||||||
|
'MS_Description', N'更新时间' ,
|
||||||
|
'SCHEMA', N'dbo',
|
||||||
|
'TABLE', N'sys_social',
|
||||||
|
'COLUMN', N'update_time'
|
||||||
|
GO
|
||||||
|
@ -1,3 +1,41 @@
|
|||||||
ALTER TABLE gen_table ADD COLUMN data_name varchar(200) NULL DEFAULT '' COMMENT '数据源名称' AFTER table_id;
|
ALTER TABLE gen_table ADD COLUMN data_name varchar(200) NULL DEFAULT '' COMMENT '数据源名称' AFTER table_id;
|
||||||
|
|
||||||
UPDATE sys_menu SET path = 'powerjob', component = 'monitor/powerjob/index', perms = 'monitor:powerjob:list', remark = 'powerjob控制台菜单' WHERE menu_id = 120
|
UPDATE sys_menu SET path = 'powerjob', component = 'monitor/powerjob/index', perms = 'monitor:powerjob:list', remark = 'powerjob控制台菜单' WHERE menu_id = 120
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- 第三方平台授权表
|
||||||
|
-- ----------------------------
|
||||||
|
drop table if exists sys_social;
|
||||||
|
create table sys_social
|
||||||
|
(
|
||||||
|
id bigint not null comment '主键',
|
||||||
|
user_id bigint not null comment '用户ID',
|
||||||
|
tenant_id varchar(20) default null comment '租户id',
|
||||||
|
auth_id varchar(255) not null comment '授权+授权openid',
|
||||||
|
source varchar(255) not null comment '用户来源',
|
||||||
|
open_id varchar(255) default null comment '原生open id',
|
||||||
|
user_name varchar(30) not null comment '登录账号',
|
||||||
|
nick_name varchar(30) default '' comment '用户昵称',
|
||||||
|
email varchar(255) default '' comment '用户邮箱',
|
||||||
|
avatar varchar(500) default '' comment '头像地址',
|
||||||
|
access_token varchar(255) not null comment '用户的授权令牌',
|
||||||
|
expire_in int default null comment '用户的授权令牌的有效期,部分平台可能没有',
|
||||||
|
refresh_token varchar(255) default null comment '刷新令牌,部分平台可能没有',
|
||||||
|
access_code varchar(255) default null comment '平台的授权信息,部分平台可能没有',
|
||||||
|
union_id varchar(255) default null comment '用户的 unionid',
|
||||||
|
scope varchar(255) default null comment '授予的权限,部分平台可能没有',
|
||||||
|
token_type varchar(255) default null comment '个别平台的授权信息,部分平台可能没有',
|
||||||
|
id_token varchar(255) default null comment 'id token,部分平台可能没有',
|
||||||
|
mac_algorithm varchar(255) default null comment '小米平台用户的附带属性,部分平台可能没有',
|
||||||
|
mac_key varchar(255) default null comment '小米平台用户的附带属性,部分平台可能没有',
|
||||||
|
code varchar(255) default null comment '用户的授权code,部分平台可能没有',
|
||||||
|
oauth_token varchar(255) default null comment 'Twitter平台用户的附带属性,部分平台可能没有',
|
||||||
|
oauth_token_secret varchar(255) default null comment 'Twitter平台用户的附带属性,部分平台可能没有',
|
||||||
|
create_dept bigint(20) comment '创建部门',
|
||||||
|
create_by bigint(20) comment '创建者',
|
||||||
|
create_time datetime comment '创建时间',
|
||||||
|
update_by bigint(20) comment '更新者',
|
||||||
|
update_time datetime comment '更新时间',
|
||||||
|
del_flag char(1) default '0' comment '删除标志(0代表存在 2代表删除)',
|
||||||
|
PRIMARY KEY (id)
|
||||||
|
) engine=innodb comment = '社会化关系表';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user